我試圖使用ProGuard生成APK,但我一直在試圖建立得到這個錯誤:com.google.android.gms.internal.zzhu:找不到引用的類android.security.NetworkSecurityPolicy
Warning: com.google.android.gms.internal.zzhu: can't find referenced class android.security.NetworkSecurityPolicy
Warning: there were 3 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:proguardRelease FAILED
Error:Execution failed for task ':app:proguardRelease'.
java.io.IOException: Please correct the above warnings first.
最近,我升級了我的Android SDK工具。在此之前,這個項目沒有提出有關proguard的問題。我發現這個職位(https://plus.google.com/+PaulBurke/posts/T3vmAnRP3q6),其中奧利弗·倫納寫道:
「因此,基本上可以不升級到最新版本,下一個谷歌圖書館也似乎需要compileSdk 23,以便能夠使用的ProGuard無需修改(警告:com.google.android.gms.internal.zzhu:找不到引用的類android.security.NetworkSecurityPolicy)「*
我更新了我的項目中使用SDK 23來編譯,但問題沒有解決。
婁,我包括我的build.gradle文件的某些部分:
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.sample.sample"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
}
.
.
.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:design:23.0.0'
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true;
}
}
你嘗試了'-dontwarn android.security **'加試着用'-dontoptimize'禁用優化,看看它是如何去 – ThanosFisherman
它不起作用:/ –
好吧試試這個:在你附加的gradle文件中,在你的'buildToolsVersion「23.0.0」'輸入下面的'useLibrary'org.apache.http.legacy''如果這個工作,我會寫關於如何和爲什麼這個工作的更詳細的答案 – ThanosFisherman