密钥店密码不正确
当我尝试为我的Flutter应用程序创建签名捆绑包时,我会得到
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
> Failed to read key key0 from store "/Users/username/keystores": keystore password was incorrect
正确的密码,我知道这是因为我写下来。我的密码只有数字和基本字母。当我运行时,
./gradlew signingReport
当我第一次尝试使用密钥库时,我会
Variant: release
Config: release
Store: /Users/myname/keystores
Alias: key0
Error: Failed to read key key0 from store "/Users/myname/keystores": keystore password was incorrect
发生同样的故障,但随后我能够通过清洁Android项目来修复它。但是现在清洁不再起作用了。
这是我的app/build.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 plugin: 'kotlin-android'
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 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "myApplicationId"
minSdkVersion 24
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources false
minifyEnabled false
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
我
sdk.dir=/Users/myName/Library/Android/sdk
flutter.sdk=/users/myName/developer/flutter
flutter.buildMode=release
flutter.versionName=0.1.5
flutter.versionCode=6
的
- 本地
- 。
- 这
- 是 工作室
When I try to create signed bundle for my flutter app I get
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
> Failed to read key key0 from store "/Users/username/keystores": keystore password was incorrect
I have the correct password and I know this because I wrote it down. My password has only numbers and basic letters. When I run
./gradlew signingReport
I get
Variant: release
Config: release
Store: /Users/myname/keystores
Alias: key0
Error: Failed to read key key0 from store "/Users/myname/keystores": keystore password was incorrect
This same failure happened when I tried to use the keystore for the first time but then I was able to fix it by cleaning the android project. But now the cleaning does not work anymore.
Here is my app/build.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 plugin: 'kotlin-android'
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 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "myApplicationId"
minSdkVersion 24
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources false
minifyEnabled false
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Here is my local.properties
sdk.dir=/Users/myName/Library/Android/sdk
flutter.sdk=/users/myName/developer/flutter
flutter.buildMode=release
flutter.versionName=0.1.5
flutter.versionCode=6
I have tried:
- Cleaning and rebuilding the project
- Default passwords ("changeit", "android", "password", "")
- Removing build folder
- Reinstalling Flutter, Dart and Android studio
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您指向
key.properties
似乎是错误的,好像您的密码是错误的。
如果缺少key.properties文件,它将丢弃错误。
在与local.properties的同一文件夹中,创建一个key.properties并输入您的值。
例如
you point gradle to
key.properties
From this seems like your password is wrong.
If key.properties file is missing it will throw errors.
In the same folder as local.properties, create a key.properties and enter you values.
eg
我遇到了同样的问题,但是我所做的就是转到我的家庭位置文件并删除upload-keystore.jks文件,一切正常
I had the same issue but what I did was to go to my home location file and delete the upload-keystore.jks file and everything worked fine