【问题标题】:FAILURE: Build failed with an exception. Execution failed for task ':app:packageRelease'FAILURE:构建失败并出现异常。任务“:app:packageRelease”执行失败
【发布时间】:2019-12-15 08:29:03
【问题描述】:

我不明白我做错了什么!

  • 出了什么问题: 任务 ':app:packageRelease' 执行失败。

    无法从存储“C:\Users\mdhvk\weather.jks”中读取密钥 weather.jks:在密钥中找不到别名为“weather.jks”的密钥 撕裂 C:\Users\mdhvk\weather.jks

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

这里是我的 key.properties

storePassword=**
keyPassword=**
keyAlias=key
storeFile=C:\\Users\\mdhvk\\weather.jks

这里是我的应用程序级别 gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "co.mdhv.weather"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务 ':app:packageRelease' 执行失败。

    无法从存储“C:\Users\mdhvk\weather.jks”中读取密钥 weather.jks:在密钥中找不到别名为“weather.jks”的密钥 撕裂 C:\Users\mdhvk\weather.jks

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

【问题讨论】:

    标签: android-studio exception flutter


    【解决方案1】:

    在 keyAlias 中重命名 key。由于该文件名为 key.properties,因此可能存在冲突。

    例如

    storePassword=**
    keyPassword=**
    keyAlias=weatherApp
    storeFile=C:\\Users\\mdhvk\\weather.jk
    

    【讨论】:

    • 现在错误 - * 出了什么问题:任务 ':app:validateSigningRelease' 执行失败。 > 未找到用于签名配置“release”的密钥库文件“D:\AndroidStudio\Clima-Flutter\android\app\Users\mdhvk\weather.jks”。
    • 位置好像变了。您是否重新创建了密钥库?
    • 是的!我重新创建密钥库
    猜你喜欢
    • 2021-06-02
    • 2021-05-01
    • 1970-01-01
    • 2018-07-28
    • 2018-10-22
    • 2019-07-14
    • 2018-10-29
    • 2020-06-13
    相关资源
    最近更新 更多