Retrofit: RxJavaCallAfapterFactory does not recognize rx.Single after proguarding

Created on 10 Feb 2016  Â·  6Comments  Â·  Source: square/retrofit

After proguarding application which uses retrofit service like

interface Service {
  @GET("/something")
  Single<String> getSomething();
}

retrofit fails with

java.lang.IllegalArgumentException: Could not locate call adapter for e.r<java.lang.String>.
                                                   Tried:
                                                    * retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
                                                    * retrofit2.ExecutorCallAdapterFactory
                                                     at retrofit2.Retrofit.nextCallAdapter(Unknown Source)
                                                     at retrofit2.Retrofit.callAdapter(Unknown Source)

Most helpful comment

-keepnames class rx.Single

On Tue, Oct 11, 2016 at 2:11 PM david-perez [email protected]
wrote:

I'm sorry, was using 2.0.0-beta4. I can't use latest version. How do I
tell ProGuard not to obfuscate the class then?

-keep class retrofit2.adapter.rxjava.RxJavaCallAdapterFactory { *; }

does not seem to do the trick. Code still goes through this execution path
https://github.com/square/retrofit/blob/2613d174be2e6f31f4f742e040412aee308849cf/retrofit-adapters/rxjava/src/main/java/retrofit2/adapter/rxjava/RxJavaCallAdapterFactory.java#L51
with the above configuration.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/square/retrofit/issues/1584#issuecomment-252998320,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEVpKywmbJrzhtlUrdiOXOiltadMYks5qy9FpgaJpZM4HXGRZ
.

All 6 comments

Single is @Beta and as such can be broken or removed at any time. Retrofit will not put its presence in the critical path for all RxJava support until it graduates to stable.

You can tell ProGuard to not obfuscate this class for now.

Having this issue. Single is no longer @Beta since RxJava 1.2.

And it's already been adjusted on master accordingly.

I'm sorry, was using 2.0.0-beta4. I can't use latest version. How do I tell ProGuard not to obfuscate the class then?

-keep class retrofit2.adapter.rxjava.RxJavaCallAdapterFactory { *; }

does not seem to do the trick. Code still goes through this execution path with the above configuration.

-keepnames class rx.Single

On Tue, Oct 11, 2016 at 2:11 PM david-perez [email protected]
wrote:

I'm sorry, was using 2.0.0-beta4. I can't use latest version. How do I
tell ProGuard not to obfuscate the class then?

-keep class retrofit2.adapter.rxjava.RxJavaCallAdapterFactory { *; }

does not seem to do the trick. Code still goes through this execution path
https://github.com/square/retrofit/blob/2613d174be2e6f31f4f742e040412aee308849cf/retrofit-adapters/rxjava/src/main/java/retrofit2/adapter/rxjava/RxJavaCallAdapterFactory.java#L51
with the above configuration.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/square/retrofit/issues/1584#issuecomment-252998320,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEVpKywmbJrzhtlUrdiOXOiltadMYks5qy9FpgaJpZM4HXGRZ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpshelley picture jpshelley  Â·  4Comments

chriskessel picture chriskessel  Â·  3Comments

attaullahpro picture attaullahpro  Â·  3Comments

zheangrybear picture zheangrybear  Â·  3Comments

bhagyasri picture bhagyasri  Â·  3Comments