首页 > 解决方案 > Flutter:无法从存储中读取密钥:无法恢复密钥

问题描述

当我试图从 Android Studio 签署我的 Flutter 应用程序时,他们给了我一个错误

FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:packageRelease'.                        
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > com.android.ide.common.signing.KeytoolException: Failed to read key myapp from store "/Volumes/PKData/Project/myapp/android/key.jks": Cannot recover key
                                                                    
Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

我遇到了这个问题,并且在应用了许多解决方案后没有一个解决方案有效,但在我的情况下它现在仍然给出这个错误

关于如何修复它的任何想法以及如何发现密码必须相同?

标签: flutterkeystoreandroid-keystorerelease-apk

解决方案


确保密钥库和私钥的密码匹配,并在 key.properties 文件中指定

并确保新的密钥密码密钥库密码相同。验证 key.properties 文件中是否也指定了相同的密码。

就我而言,问题是密钥存储密码密钥密码不正确。所以生成一个新密钥,它将起作用(只需确保新密钥密码密钥库密码相同)


推荐阅读