在Android Studio中,我的Gradle版本遇到错误。我需要在哪里更改代码以解决此问题?我是android应用程序开发的新手。
这是我的项目build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
allprojects {
repositories {
jcenter()
google()
maven { url 'https://jitpack.io' }
}
}
这是我的应用程序build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.cisco.amp"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "2.0.0.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Override versionName and versionCode if passed as arguments from build script
if (project.hasProperty("versionName")) {
versionName = project.property("versionName")
}
if (project.hasProperty("versionCode")) {
def versionCodeStr = project.property("versionCode")
if (versionCodeStr != null && !versionCodeStr.equals("")) {
versionCode = Integer.valueOf(versionCodeStr)
}
}
}
signingConfigs {
release {
if (project.hasProperty("keyAlias")) {
keyAlias = project.property("keyAlias")
}
if (project.hasProperty("keyPassword")) {
keyPassword = project.property("keyPassword")
}
if (project.hasProperty("storeFile")) {
storeFile = file(project.property("storeFile"))
}
if (project.hasProperty("storePassword")) {
storePassword = project.property("storePassword")
}
}
}
buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
flavorDimensions "buildMode"
productFlavors {
automation {
dimension "buildMode"
applicationIdSuffix ".automation"
versionNameSuffix "-automation"
}
prod {
dimension "buildMode"
}
}
testOptions {
animationsDisabled true
}
jacoco {
version '0.8.4'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha06'
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.annotation:annotation:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
}
错误日志:
Task :app:validateSigningAutomationRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningAutomationRelease'.
> Keystore file not set for signing config release
最佳答案
能够通过注释掉我的app build.gradle中的以下2个依赖项来解决此问题
/*debug {
testCoverageEnabled true
}*/
和
/*jacoco {
version '0.8.4'
}*/
关于android - gradle build:任务 ':app:validateSigningAutomationRelease'的执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58967665/