Retrofit + RxJava:java.lang.IllegalArgumentException:找不到f.e <b.v>

时间:2016-12-28 07:13:03

标签: android retrofit proguard

我对Retrofit + rx和ProGuard存在严重问题。

  1. App适用于调试
  2. 应用程序在发布时使用minifyEnabled false
  3. 应用程序在发布时使用minifyEnabled true和useProguard 假
  4. 应用程序无法在发布时使用minifyEnabled = true
  5. 此代码是如何创建Retrofit:

    @Provides @Singleton Retrofit provideRetrofit(Call.Factory factory, Environment environment) { //A Gson formatter to covert string in date Gson gson = new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") .create(); return new Retrofit.Builder() .baseUrl(environment.getBaseUrl()) .callFactory(factory) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .build(); }
    

    这是我的ProGuard:

    http://pastebin.com/696myxMM

    令人困惑,抱歉,但我尝试了所有解决方案。

    我有这个例外:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxx.xxxx/com.xxx.xxx.android.entrance.EnterActivity}: java.lang.IllegalArgumentException: Unable to create call adapter for f.e<b.v> for method d.a at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.IllegalArgumentException: Unable to create call adapter for f.e<b.v> for method d.a at e.l$a.a(ServiceMethod.java:720) at e.l$a.b(ServiceMethod.java:234) at e.l$a.a(ServiceMethod.java:160) at e.k.a(Retrofit.java:166) at e.k$1.invoke(Retrofit.java:145) at java.lang.reflect.Proxy.invoke(Proxy.java:393) at $Proxy1.a(Unknown Source) at com.xxx.xxx.network.b.a.b.a(EnterApiImpl.java:37) at com.xxxx.xxx.network.b.a.d.a(EnterInteractorImpl.java:32) at com.xxx.xxxxx.android.entrance.d.a(EnterPresenterImpl.java:71) at com.xxxx.xxxx.android.entrance.d.a(EnterPresenterImpl.java:56) at com.xxxx.xxx.android.entrance.EnterActivity.onCreate(EnterActivity.java:45) at android.app.Activity.performCreate(Activity.java:6251) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) ... 9 more Caused by: java.lang.IllegalArgumentException: Could not locate call adapter for f.e<b.v>. Tried: * com.d.a.a.a.f
    

0 个答案:

没有答案