SigningConfig“release”缺少必需的属性“keyPassword”

use*_*015 27 android release build.gradle

该错误抱怨我尚未设置signingConfig.release.keyPassword,但我正在设置它。

我已经尝试对密码进行硬编码,而不是从 key.properties 文件中检索它,但这没有帮助。

// build.gradle file  

// ... the rest of the build code

android {        

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

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
} 
Run Code Online (Sandbox Code Playgroud)

小智 25

试试这个:在build.gradle(Module: app)

// ... the rest of the build code

android {

    signingConfigs {
        release {
            storeFile file('your_key_store_path')
            storePassword 'your_store_password'
            keyAlias = 'your_key_alias'
            keyPassword 'your_key_password'
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

您还可以Signing Configs在以下位置创建Android Studio
File>>Project Structure选择Modules> 选择Signing Configs。在 中Signing Configsdebug已经创建了配置,但您可以通过按 图标来创建新配置+


bad*_*n77 15

就我而言,我使用了一台新电脑

[project]/android/key.properties
Run Code Online (Sandbox Code Playgroud)

文件丢失,因为我将其添加到存储库中.gitignore,因此它不在存储库中。它具有以下形式:https ://docs.flutter.dev/deployment/android#reference-the-keystore-from-the-app