wcs__1349 2019-03-13 11:17
浏览 1271

proguard+retrofit2.4+adapter-rxjava2-2.4.0+rxjava2+rxandroid2

目前在做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

有哪位大神帮忙看下,如何解决?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
    • ¥20 matlab yalmip kkt 双层优化问题
    • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多