Android APK 签名错误:无法从密钥库读取密钥
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20453249/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
APK signing error : Failed to read key from keystore
提问by Hymany
I'm developing android app under intellij and gradle. and using following way to generate keystore file:
我正在 Intellij 和 gradle 下开发 android 应用程序。并使用以下方式生成密钥库文件:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
then used the keystore file in build.gradle:
然后使用 build.gradle 中的密钥库文件:
signingConfigs {
robert {
storePassword 'robert'
storeFile file('/Users/bournewang/Documents/Project/android.keystore')
keyPassword 'robert'
keyAlias 'mike'
}
}
when finally trying to generate signed apk file: ./gradlew assembleRelease
最后尝试生成签名的 apk 文件时:./gradlew assembleRelease
it gives the error:
它给出了错误:
Execution failed for task ':Myexample:packageRelease'.
任务“:Myexample:packageRelease”执行失败。
Failed to read key from keystore
无法从密钥库读取密钥
采纳答案by cooperok
Check your keystore file for first, in you example you creating file with name my-release-key.keystore. If its correct and really present in folder Users/bournewang/Documents/Project
check alias, in your example it is -alias alias_name, but in config you specified alias mike
首先检查您的密钥库文件,在您的示例中,您创建名为 my-release-key.keystore 的文件。如果它正确并且确实存在于文件夹 Users/bournewang/Documents/Project
检查别名中,则在您的示例中它是-alias alias_name,但在配置中您指定了别名mike
回答by Tom Susel
In order to find out what's wrong you can use gradle's signingReport
command.
为了找出问题所在,您可以使用 gradle 的signingReport
命令。
On mac:
在 Mac 上:
./gradlew signingReport
On Windows:
在 Windows 上:
gradlew signingReport
回答by ptitvinou
回答by fincode
Removing double-quotes
solve my problem, now its:
删除double-quotes
解决了我的问题,现在是:
DEBUG_STORE_PASSWORD=androiddebug
DEBUG_KEY_ALIAS=androiddebug
DEBUG_KEY_PASSWORD=androiddebug
回答by Stjepan Golemac
In my case, while copying the text from other source it somehow included the space at the end of clipboard entry. That way the key password had a space at the end.
就我而言,在从其他来源复制文本时,它以某种方式包含了剪贴板条目末尾的空间。这样密钥密码的末尾就有一个空格。
回答by Mohamed Azher
For someone not using the signing configs and trying to test out the Cordova Release command by typing all the parameters at command line, you may need to enclose your passwords with single quotes if you have special characters in your password
对于不使用签名配置并尝试通过在命令行键入所有参数来测试 Cordova Release 命令的人,如果您的密码中有特殊字符,您可能需要用单引号将密码括起来
cordova run android --release -- --keystore=../my-release-key.keystore --storePassword='password' --alias=alias_name --password='password'
回答by Daniel Nyamasyo
The big thing is either the alias or the other password is wrong. Kindly check your passwords and your issue is solved. Incase you have forgotten password, you can recover it from the androidStuido3.0/System/Log ... Search for the keyword password and their you are saved
重要的是别名或其他密码错误。请检查您的密码,您的问题已解决。如果您忘记了密码,您可以从androidStuido3.0/System/Log 找回密码... 搜索关键字密码并保存您的密码
回答by A-S
It could be any one of the parameter, not just the file name or alias - for me it was the Key Password.
它可以是任何一个参数,而不仅仅是文件名或别名——对我来说,它是密钥密码。