失败:构建失败,发生异常。任务':app:packageRelease'的执行失败

时间:2019-08-07 16:35:07

标签: android-studio exception flutter

我不知道我做错了什么地方!

  • 出了什么问题: 任务':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'
}

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

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

      

    无法从商店“ C:\ Users \ mdhvk \ weather.jks”中读取关键weather.jks:在密钥中找不到别名为“ weather.jks”的密钥   撕毁C:\ Users \ mdhvk \ weather.jks

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

1 个答案:

答案 0 :(得分:0)

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

例如

storePassword=**
keyPassword=**
keyAlias=weatherApp
storeFile=C:\\Users\\mdhvk\\weather.jk
相关问题