Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用Proguard改装警告_Android_Proguard_Android Proguard - Fatal编程技术网

Android 使用Proguard改装警告

Android 使用Proguard改装警告,android,proguard,android-proguard,Android,Proguard,Android Proguard,我在我的android项目中打开了proguard,得到了下面的警告。在谷歌上搜索,但找不到太多信息 警告:改装。平台$Java8:找不到引用的类 org.codehaus.mojo.animal_sniffer.ignorejrrequirement 我已经在我的项目中加入了改进2 proguard规则 -dontwarn retrofit2.** -keep class retrofit2.** { *; } -keepattributes Signature -keepattributes

我在我的android项目中打开了proguard,得到了下面的警告。在谷歌上搜索,但找不到太多信息

警告:改装。平台$Java8:找不到引用的类 org.codehaus.mojo.animal_sniffer.ignorejrrequirement

我已经在我的项目中加入了改进2 proguard规则

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

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
更改如下:

-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
在Java 8虚拟机上运行时,改装页面已注意到此proguard构建:

为什么会发生这种情况

原因是: 编译器尝试引用Java8类,当您没有通过Proguard提到它时,在您明确提到它之后,将不会使用Java8类。 例如
java 8的包java.nio.*在Android上不可用,永远不会被调用

请按照proguard规则改装2.3.0和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.**

改装主页上的官方规则,加上-dontwarn javax.annotation.**对我来说是必需的