Android - 签名 APK - Gradle 执行失败

标签 android build.gradle

我已经成功地为我的应用程序生成签名的 apk 并在我的团队中本地分发它。但是突然两天前我无法生成签名的apk。 当我将构建变量更改为“发布”时,gradle 调用完成,没有任何错误或警告。但是在创建签名的 apk 时出现以下错误:

Information:Compilation completed with 1 error and 0 warnings in 11 sec
Information:1 error
Information:0 warnings
Error:Gradle: Execution failed for task ':module_name:proguardRelease'.
    > java.io.IOException: Please correct the above warnings first.

build.gradle:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    signingConfigs {
        release {
            storeFile file('release.keystore')
            storePassword '*************'
            keyAlias '*********'
            keyPassword '**************'
        }
    }
    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/volley.jar')
    compile files('libs/StarIOPort3.1.jar')
    compile files('libs/logentries-android-2.1.2.jar')
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.wrapp.floatlabelededittext:library:0.0.3'
}

在哪里可以看到警告? “消息”中没有警告。同样在 gradle 控制台中。

这是什么原因造成的?我该如何解决这个问题?

最佳答案

如果您使用的是 Windows,请打开一个 cmd 提示符,然后 cd 到您的项目的根目录。里面应该有gradlew.bat(由Android Studio自动创建)。尝试运行 gradlew.bat clean assembleRelease -d 以查看混淆器警告。

您需要 fix these proguard warnings before it lets you do a successful build .您可以通过将 -dontwarn org.apache.*(或与您的警告相关的类似内容)添加到您的项目混淆器文件 release 部分来修复它们。

关于Android - 签名 APK - Gradle 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26185210/

相关文章:

Android 复制/粘贴菜单立即关闭

java - ClassCastException 错误

android - 如何在 Android API < 21 上使用 setImageTintList()

android - 如何在 WebView 中打开 PDF/Docx

junit - 正在查看junit test的结果?

android - 没有足够的信息来推断类型变量 T

gradle jacocoTestReport 不起作用?

gradle - 无法启动 Grails 4 应用程序,因为无法找到或加载主类

java - 安卓: "Unable to instantiate Fragment"

错误: "You must set the property ' aspectjVersion' before applying the aspectj plugin"when using kotlin DSL