【发布时间】:2023-08-08 15:57:01
【问题描述】:
我只是在我的项目中启用 proguard 。之后,我使用 debug apk 成功运行了 apk。
当我尝试创建 签名的 Apk 时出现错误
Error:Execution failed for task ':app:proguardRelease'.
> java.io.IOException: Please correct the above warnings first.
我的 Gradle 文件是这样的
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.android4dev.navigationview"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.android.gms:play-services:8.1.0'
}
警告
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.
我尝试了-dontwarn org.apache.lang.**,但仍然遇到同样的问题
谁能帮我解决这个问题。
【问题讨论】:
-
使用
minifyEnabled false -
@Binil S 你能发布你的警告吗?
-
@IntelliJAmiya 我想他想启用 proguard 所以
minifyEnabled应该是true -
是的,这就是为什么我将 minifyEnabled 设为 true @IntelliJAmiya
-
警告更新,你能检查@Dinesh Kannan
标签: android build android-gradle-plugin build.gradle