使用正确的密钥库密码构建应用程序包时出现错误密钥库被篡改或密码不正确

问题描述 投票:0回答:2

我的 flutter 应用程序中的 keystore.jks 文件有问题,

我可以使用

keytool -list -v -keystore keystore.jks
命令和密码(不是任何默认密码,您会收到警告)打开 keystore.jks 文件,但是在尝试构建 appbundle 时失败并出现错误:
Keystore was tampered with, or password was incorrect...

遇到这样的情况我该怎么办?

PS:该应用程序不是新的,已经上传到 Google Play,我有一段时间因密码错误而在 keytool 命令中失败,现在我尝试了另一个密码,它成功了。
另外,我正在另一台电脑上构建应用程序,而不是生成密钥库文件的电脑,这会影响什么吗?

android flutter keystore android-keystore android-app-bundle
2个回答
1
投票

分享我的解决方法也许对其他人有帮助, 我能够通过在 build.gradle 中移动商店的凭据来构建 appbundle,而不是从 key.properties 调用它们,即使我有所需的 key.properties 和 keystore 文件。

所以代替这个:

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

我这样做了:

   signingConfigs {
       release {
           keyAlias 'myKey'
           keyPassword "keyPassword"
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword "storePassword"
       }
   }

当然,不要将这些更改提交到 git,这样就不会共享 jks 文件的凭据。


0
投票

我也花了一个小时的时间来解决这个错误。对我有帮助的是简单地将创建后保存的密钥(您希望在某个地方作为备份)复制到 android/app 文件夹中,然后再次运行 flutter,它就起作用了。当然,先删除旧密钥。

© www.soinside.com 2019 - 2024. All rights reserved.