jarly
jarly

Reputation: 231

Retrofit warning with Proguard

I turned proguard on in my android project and got the warning below. Searched on Google but couldn't find much info.

Warning:retrofit.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

I've put the retrofit2 proguard rules in my project.

-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

Upvotes: 0

Views: 1222

Answers (2)

Avinash Roy
Avinash Roy

Reputation: 973

change it like this:

-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8

Retrofit page has noted about this proguard build,when running on Java 8 VMs:

Why this happens?

Reason is: Compiler tries to reference Java 8 classes,When u don't mention it through Proguard,After u explicitly mention it,Java 8 classes won't be used. For example Package java.nio.* of Java 8 isn't available on Android and will be never called

Upvotes: 0

Krishna Meena
Krishna Meena

Reputation: 6351

Use following proguard rules for Retrofit 2.3.0 and okhttp 3.8.0

-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8adapters.
-keepattributes Signature
-keepattributes Exceptions
-dontwarn org.xmlpull.v1.**
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**

Upvotes: 1

Related Questions