我一直在使用 Android Studio 开发应用程序并进行测试,我准备发布到 Google Play。
当我尝试创建签名的 APK 时,在创建 key 后,gradle 构建停止并显示以下消息:
Please correct the above warnings first.
经过大量研究,我发现问题可能出在 build.gradle (Module: app) 中,我读到缺少这一行:
lintOptions {
checkReleaseBuilds false
abortOnError false
}
但是,即使有这条线,它也不会起作用。这是消息:
编辑:
这是我的 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:
最佳答案
我今天遇到了这个错误,浪费了几个小时。我这样做了
- Updated all app dependencies like
google.gms
andgoogle.support
libraries.- Updated gradle wrapper version in
gradle-wrapper.properties
file.- Updated gradle plugin version in project level
build.gradle
.
如果你问我在哪里可以找到最新版本
您将在所有这三个方面获得建议,只需使用 alt + enter
键接受建议即可。
关于android - 无法创建签名 APK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50417388/