使用 Android Studio:1.2.RC
我在 .gradle 中启用了 proguard:
````
minifyEnabled=true
and added these rules to my proguard-rules.pro:
-dontwarn com.squareup.**
-dontwarn okio.**
and added these lint rules to my .gradle file:
warningsAsErrors false
abortOnError false
disable 'InvalidPackage'
```
但当我尝试在调试模式下运行应用程序时,我仍然收到这些警告:
```
Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: there were 14 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardDebug FAILED
```
这很奇怪,因为我还将这些规则/选项添加到了所有依赖于 OkHttp/Picasso 的库模块中,我不知道哪里出了问题,也许这是一个 Android Studio 错误?有人对这个问题有任何线索吗?
我已经开了一个issue https://github.com/square/okio/issues/144#issuecomment-95573233在 github 上。
您已禁用警告
-dontwarn com.squareup.**
-dontwarn okio.**
但是对于软件包呢(如您发布的日志中所示)
-dontwarn org.codehaus
-dontwarn java.nio
无论哪种方式,忽略警告都不是一个好方法。
尝试防止这些类被缩小,如下所示:
-keep public class org.codehaus.**
-keep public class java.nio.**
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)