问题描述
我正在 Intellij 和 gradle 下开发 android 应用程序.并使用以下方式生成密钥库文件:
I'm developing android app under intellij and gradle. and using following way to generate keystore file:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
然后使用 build.gradle 中的密钥库文件:
then used the keystore file in build.gradle:
signingConfigs {
robert {
storePassword 'robert'
storeFile file('/Users/bournewang/Documents/Project/android.keystore')
keyPassword 'robert'
keyAlias 'mike'
}
}
当最终尝试生成签名的 apk 文件时:./gradlew assembleRelease
when finally trying to generate signed apk file: ./gradlew assembleRelease
它给出了错误:
任务:Myexample:packageRelease"执行失败.
Execution failed for task ':Myexample:packageRelease'.
无法从密钥库读取密钥
推荐答案
首先检查您的密钥库文件,在您的示例中,您创建名为 my-release-key.keystore 的文件.如果它正确并且确实存在于文件夹 Users/bournewang/Documents/Project
中,请检查别名,在您的示例中它是 -alias alias_name,但在配置中您指定了别名 迈克
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
这篇关于APK 签名错误:无法从密钥库读取密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!