目前在做android的代码混淆,没有混淆之前,代码运行正常,当打开混淆之后,代码运行时出现如下差错:
03-13 10:39:59.936 6285 6285 E AndroidRuntime: java.lang.IllegalArgumentException: Unable to create call adapter for class io.reactivex.b
03-13 10:39:59.936 6285 6285 E AndroidRuntime: for method RequestApis.getCameraInfo
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.ServiceMethod$Builder.methodError()
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.ServiceMethod$Builder.createCallAdapter()
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.ServiceMethod$Builder.build()
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.Retrofit.loadServiceMethod()
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.Retrofit$1.invoke()
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at java.lang.reflect.Proxy.invoke(Proxy.java:393)
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at $Proxy0.getCameraInfo(Unknown Source)
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at com.xxx.helper.RetrofitHelper.getCameraInfo()
......
03-13 10:39:59.936 6285 6285 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Flowable return type must be parameterized as Flowable<Foo> or Flowable<? extends Foo>
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory.get()
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.Retrofit.nextCallAdapter()
03-13 10:39:59.936 6285 6285 E AndroidRuntime: at retrofit2.Retrofit.callAdapter()
其中proguard配置:
# Retrofit
-dontwarn retrofit2.**
-dontwarn org.codehaus.mojo.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepattributes *Annotation*
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
-dontwarn retrofit2.adapter.rxjava.CompletableHelper$** # https://github.com/square/retrofit/issues/2034
#To use Single instead of Observable in Retrofit interface
-keepnames class rx.Single
#Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod
# Retain service method parameters when optimizing.
-keepclassmembers,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
-keepattributes RuntimeVisibleAnnotations
-keepattributes RuntimeInvisibleAnnotations
-keepattributes RuntimeVisibleParameterAnnotations
-keepattributes RuntimeInvisibleParameterAnnotations
-keepattributes EnclosingMethod
-keepclasseswithmembers interface * {
@retrofit2.* <methods>;
}
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
# OkHttp3
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
#OkHttp
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
jar版本:
adapter-rxjava2-2.4.0.jar
retrofit-2.4.0.jar
reactive-streams-1.0.2.jar
rxjava-2.1.14.jar
rxandroid-2.0.2.aar
有哪位大神帮忙看下,如何解决?