生成登录 APK 在 Android Studio 中显示错误
Generate Signin APK showing err in Android Studio
我已经将 Android 项目从 eclipse IDE 转换为 Android Studio IDE。我在 eclipse 中使用了 progurard 没有任何错误,但是在将项目转换为 android studio 后它显示错误。当我尝试为构建发布 apk 生成登录 apk 然后显示如下错误..
Error:Execution failed for task ':calApps:transformClassesAndResourcesWithProguardForRelease'.
java.io.IOException: Please correct the above warnings first.
我的progurard-project.txt是这样的
.......
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontoptimize
-dontpreverify
-dontwarn android.support.**
-verbose
......
-keep public class * extends android.app.Activity
我的 build.gradle 文件是这样的
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
// buildToolsVersion '19.1.0'
useLibrary 'org.apache.http.legacy'
compileOptions.encoding = 'ISO-8859-1'
defaultConfig {
applicationId "com.packagename.apps"
minSdkVersion 15
targetSdkVersion 17
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.0'
compile project(':viewPagerIndicatorLibrary')
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
//compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.android.support:multidex:1.0.0'
}
请帮忙....提前致谢...
我发现当 SDK、构建工具和 Gradle 插件的版本不匹配(在兼容性方面)时会发生此错误。
[解决方案是验证我们是否使用最新版本]
gradle插件放在项目的build.gradle(Project:projectName)文件中。
其他版本在模块的build.gradle(Module:app)文件中。
例如,对于 SDK 23,您必须使用构建工具 23.0.1 和 gradle 插件版本 1.3.1。
我更改 gradle 插件版本,然后在更改设置后清理项目以解决我的问题。
您已在您的应用程序中启用 progurd 以生成签名的 APK。删除与您在应用程序中使用的库的 progurd 相关的所有警告,以获取更多详细信息,请参阅 this link
我已经将 Android 项目从 eclipse IDE 转换为 Android Studio IDE。我在 eclipse 中使用了 progurard 没有任何错误,但是在将项目转换为 android studio 后它显示错误。当我尝试为构建发布 apk 生成登录 apk 然后显示如下错误..
Error:Execution failed for task ':calApps:transformClassesAndResourcesWithProguardForRelease'.
java.io.IOException: Please correct the above warnings first.
我的progurard-project.txt是这样的
.......
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontoptimize
-dontpreverify
-dontwarn android.support.**
-verbose
......
-keep public class * extends android.app.Activity
我的 build.gradle 文件是这样的
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
// buildToolsVersion '19.1.0'
useLibrary 'org.apache.http.legacy'
compileOptions.encoding = 'ISO-8859-1'
defaultConfig {
applicationId "com.packagename.apps"
minSdkVersion 15
targetSdkVersion 17
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.0'
compile project(':viewPagerIndicatorLibrary')
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
//compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.android.support:multidex:1.0.0'
}
请帮忙....提前致谢...
我发现当 SDK、构建工具和 Gradle 插件的版本不匹配(在兼容性方面)时会发生此错误。
[解决方案是验证我们是否使用最新版本]
gradle插件放在项目的build.gradle(Project:projectName)文件中。
其他版本在模块的build.gradle(Module:app)文件中。
例如,对于 SDK 23,您必须使用构建工具 23.0.1 和 gradle 插件版本 1.3.1。
我更改 gradle 插件版本,然后在更改设置后清理项目以解决我的问题。
您已在您的应用程序中启用 progurd 以生成签名的 APK。删除与您在应用程序中使用的库的 progurd 相关的所有警告,以获取更多详细信息,请参阅 this link