android - gradle build:任务 ':app:validateSigningAutomationRelease'的执行失败

标签 android android-studio gradle build

在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/

相关文章:

java - 如何在饼图之外显示测试

spring - 无法使用 Gradle 在 Spring Boot 闭包中设置 Layout = ZIP

android - 此类在 API 级别 R 中已弃用。-这是什么意思?

android - 以编程方式在相对布局中的多行中添加 TextView

android - 如何在 Android Studio 中无错误地覆盖/更新 Jama Matrix?

android-studio - 错误 : This project uses AndroidX dependencies, 但 'android.useAndroidX' 属性未启用。在 gradle.prop 中将此属性设置为 true

android - 从 android 上的 IP 摄像机接收视频流

android - FirebaseRecyclerAdapter - 如何在创建后更改数据库查询

java - Lombok @getter 无法在 src/test/java 包中工作

java - 获取 "Failed to capture snapshot of input files for task ' :compileJava' "