关于 Square 的 Okio 库参考的 Android-Studio-1.2.RC Proguard 警告 [英] Android-Studio-1.2.RC Proguard warnings on Square's Okio library reference
问题描述
使用 Android Studio:1.2.RC
WIth Android Studio: 1.2.RC
我在 .gradle 中启用了 proguard:```
I enabled proguard in .gradle: ```
minifyEnabled=true
<代码>并将这些规则添加到我的 proguard-rules.pro 中:
-dontwarn com.squareup.**
-dontwarn okio.**
<代码>并将这些 lint 规则添加到我的 .gradle 文件中:
warningsAsErrors false
abortOnError false
disable 'InvalidPackage'
```
但是当我尝试在调试模式下运行应用程序时,我仍然收到这些警告:
But I still get these warning when I try to run the app in debug mode:
```
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 的错误?有人对这个问题有任何线索吗?
It's so weird since I also added these rules/options to all my library modules that depend on OkHttp/Picasso, I don't know where went wrong, perhaps this is a Android Studio bug ? Does anyone have any clues to this problem ?
我在 github 上打开了一个问题.
I have opened an issue on github.
推荐答案
天哪,我忘了为我的调试版本指定 proguard 文件,添加 'proguardFiles' 规则可以解决问题:
Oh Christ, I forgot to specify the proguard file for my debug build, adding the 'proguardFiles' rule would solve the problem:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".debug"
}
}
其中一个时刻,您努力寻找钥匙,但钥匙就在您的口袋里.
One of those moments you searched hard for your keys and it's right in your pocket.
这篇关于关于 Square 的 Okio 库参考的 Android-Studio-1.2.RC Proguard 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!