android - 无法创建签名 APK

标签 android apk android-proguard signed

我一直在使用 Android Studio 开发应用程序并进行测试,我准备发布到 Google Play。

当我尝试创建签名的 APK 时,在创建 key 后,gradle 构建停止并显示以下消息:

Please correct the above warnings first.

经过大量研究,我发现问题可能出在 build.gradle (Module: app) 中,我读到缺少这一行:

lintOptions {
    checkReleaseBuilds false
    abortOnError false
}

但是,即使有这条线,它也不会起作用。这是消息:

Error

编辑:

这是我的 build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "br.com.companyname.appname"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "2018.05.11 v2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

dependencies {
    implementation project(path: ':componentsutils')
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'


    implementation group: 'org.apache.commons', name: 'commons-text', version: '1.2'
    implementation group: 'commons-io', name: 'commons-io', version: '2.4'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:palette-v7:27.1.1'
    implementation 'com.squareup.retrofit:retrofit:1.9.0'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'com.github.d-max:spots-dialog:0.4@aar'
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    implementation 'br.com.livroandroid:android-utils:1.0.2'
    implementation 'com.android.support:exifinterface:27.1.1'
}

编辑 2

深入构建错误,我发现了这个 Stacktrace:

StackTrace error

最佳答案

我今天遇到了这个错误,浪费了几个小时。我这样做了

  1. Updated all app dependencies like google.gms and google.support libraries.
  2. Updated gradle wrapper version in gradle-wrapper.properties file.
  3. Updated gradle plugin version in project level build.gradle.

如果你问我在哪里可以找到最新版本

您将在所有这三个方面获得建议,只需使用 alt + enter 键接受建议即可。

关于android - 无法创建签名 APK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50417388/

相关文章:

android - 如何解决 Facebook 登录时出现 "Login Error: There is an error in logging you into this application. Please try again later."错误

java - 反编译 APK 上的 .smali 文件

android - Proguard with Butterknife 防止混淆类名

java - Android 中的 AutoSuggest 来自 php 的 jsonencoded 数组

android - android 提供的 json 版本的 Apache http 客户端错误

android - 使用 Android Studio 如何获得签名的、非调试的和 zip 对齐的 APK?

android - 无法使用 android studio 3.1.3 设置 ApkVariantOutputImpl_Decorated 的只读属性 'outputFile' 的值

android - 公开发布的Android库无法正确维护

java - Android 房间显示错误 AppDatabase_Impl 不存在

java - 带有 5 个进度条的评级进度图表