改造 - 无法在发布APK中创建呼叫适配器

时间:2017-01-29 17:18:59

标签: java android retrofit

在调试模式下构建时,我的应用程序运行正常。但是,当我构建一个签名的APK并进行测试时,我发现这些错误:

Unable to create call adapter for class example.Simple
    for method SimpleService.getSimple

我需要使用Retrofit让我的应用在生产环境中工作吗?

修改

添加我的proguard-rules.pro

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\Think\AppData\Local\Android\sdk1/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
#retrolambda
-dontwarn java.lang.invoke.*
#endRetrolambda
#picasso
-dontwarn com.squareup.okhttp.**
#endPicasso
#stripe
-keep class com.stripe.** { *; }
#endStripe
#retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes *Annotation*,Signature, Exceptions

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
#endRetrofit
#okHttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
#endOkHttp
#okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
#endOkio
#rx
-keep class rx.schedulers.Schedulers {
    public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
    public <methods>;
}
-keep class rx.schedulers.TestScheduler {
    public <methods>;
}
-keep class rx.schedulers.Schedulers {
    public static ** test();
}
#endRx

0 个答案:

没有答案