签发Android Release Build的问题无法从密钥库读取密钥" [英] Issue signing Android Release Build " Failed to read key from keystore"
问题描述
我正在使用gradle (assembleRelease)来生成发行版APK.
I'm using gradle (assembleRelease) to generate the release apk.
我已将密钥库文件保存在project/app/filename.keystore中(在应用程序中)
I have saved the keystore file in project/app/filename.keystore (Within the application)
我已经指定了有关gradle.properties文件登录的详细信息
I have specified details related to signing in gradle.properties file
RELEASE_STORE_FILE=filename.keystore
RELEASE_STORE_PASSWORD=****
RELEASE_KEY_ALIAS=alias
RELEASE_KEY_PASSWORD=****
我的build.gradle文件具有与签名相关的以下内容
My build.gradle file has the following related to signing
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
我在以下相同的gradle文件中指定了签名配置
I have specified signing configurations in the same gradle file as below
buildTypes {
release {
signingConfig signingConfigs.release
}
}
但是,当我尝试创建发行版时,我会不断出现错误
However, when I'm trying to create the release build I keep getting following error
Error:Execution failed for task ':app:package<flavor>Release'.
> Failed to read key from keystore
我尝试关注
-
提供了错误的密码以查看是否可以找到该文件.给出以下错误以及正确的路径,因为我认为可以找到该文件.
Giving a wrong password to see if the file can be found.Gives the following error with correct path there for I assume the file can be found.
无法从商店"中读取密钥:密钥库被篡改或密码错误
感谢您的投入!
推荐答案
我的问题是我输入了随机keyAlias
.当尝试使用IDE对apk进行签名(IntlliJ Idea和Android Studio:生成"菜单->生成签名的APK)时,通过单击用于输入密钥别名的文本框旁边的椭圆按钮(...
),我找到了正确的密钥别名我之前为我的密钥库设置的.仔细检查您是否没有为密钥库输入临时的随机密码和keyAlias,因为它们应该与创建时为密钥库设置的密码和密钥别名相同.
My problem was that I had entered a random keyAlias
. When trying to sign the apk using the IDE (IntlliJ Idea and Android Studio: Build menu -> generate signed APK), by clicking the ellipse button (...
) next to the textbox for entering key alias, I found the correct key alias that I had earlier set for my keystore. Double check that you are not entering some ad-hoc random password and keyAlias for your keystore as they should be identical to the password and key alias you set for your keystore when creating it.
如果您忘记了密码或密钥别名,那么恐怕您必须创建一个新的密钥库,因为没有这些密钥库就无法读取密钥库.我建议将这两个属性(并附加您的密钥库文件)保存在类似Lastpass的密码管理器中,以备将来使用.
If you have forgotten either the password or the key alias, I am afraid you have to create a new keystore as you cannot read your keystore without these. I suggest saving these two properties (and attaching your keystore file) in a password manager like Lastpass, as you need them in future.
这篇关于签发Android Release Build的问题无法从密钥库读取密钥"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!