Android 未找到证书链,如何修复并发布到 Google Play 商店?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23750259/
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
Certificate chain not found, how to fix and publish to Google Play Store?
提问by campbellwarren
ERROR MESSAGE:
错误信息:
jarsigner: Certificate chain not found for: project_foo.<br/>
project_foo must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
QUESTION: How do I include a public key certificate chain to address the error?
问题:如何包含公钥证书链来解决错误?
BACKGROUND: The App Developer has completed an Android app and delivered an unsigned APK called Foo.apk. My objective is to sign and zipalign the APK in preparation for uploading it to the Google Play store. My keystore is located at C:\Path\.keystore on a Windows machine.
背景:应用开发者已经完成了一个 Android 应用并交付了一个名为 Foo.apk 的未签名 APK。我的目标是对 APK 进行签名和压缩对齐,以准备将其上传到 Google Play 商店。我的密钥库位于 Windows 机器上的 C:\Path\.keystore。
COMMAND LINE, my command:
命令行,我的命令:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore C:\Path\.keystore Foo.apk project_foo
COMMAND LINE, response:
命令行,响应:
Enter Passphrase for keystore:
jarsigner: Certificate chain not found for: project_foo.<br/>
project_foo must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
ALSO TRIED: Verified that I remember the correct password. Using 'keytool -list' from the command line shows me the expected list (it includes one private key).
还尝试过:验证我记得正确的密码。从命令行使用 'keytool -list' 会向我显示预期的列表(它包括一个私钥)。
PREVIOUS OS QUESTION: certificate chain not foundasked using a .cer
file from Verisign. I have no similar file available.
以前的操作系统问题:未找到使用.cer
Verisign 文件询问的证书链。我没有可用的类似文件。
OTHER INFORMATION: Windows 7 machine, using standard Windows command prompt.
其他信息:Windows 7 机器,使用标准 Windows 命令提示符。
回答by Umit Kaya
keytool -keystore formconnect.keystore -list -v
keytool -keystore formconnect.keystore -list -v
You can use this command to find out your alias name after you have generated your key.
生成密钥后,您可以使用此命令查找别名。
First line of execution contains the Alias name: <value>
If keytool is used then alias name might be "mykey".
执行的第一行包含别名:<value>
如果使用 keytool,则别名可能是“mykey”。
Use that alias name while packaging the application.
在打包应用程序时使用该别名。
回答by tanveer ahmad dar
i had the same issue my commands were
我有同样的问题我的命令是
to generate key
生成密钥
keytool -genkey -v -keystore testapp-key.keystore -alias testapp-key -keyalg RSA -keysize 2048 -validity 10000
and then i did this to sign the app
然后我这样做是为了签署应用程序
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore testapp-key.keystore testapp.apk testapp
i got this error
我收到这个错误
jarsigner: Certificate chain not found for: testapp.<br/>
project_foo must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
then i replaced the alias 'testapp'in the jarsignir command with the key alias that is 'testapp-key'it is in first command i.e. key generation command
然后我将 jarsignir 命令中的别名“testapp”替换为密钥别名“testapp-key”,它在第一个命令中,即密钥生成命令
the command will look like this
该命令将如下所示
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore testapp-key.keystore testapp.apk testapp
in your case it will be like this
在你的情况下,它会是这样的
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore C:\Path\.keystore Foo.apk your-key-alias
回答by campbellwarren
The Developer on our team proposed the solution that fixed the problem. Previously I had copied the Foo.apk into the directory with the jarsigner.exe and tried to run it there. He proposed:
我们团队的开发人员提出了解决问题的解决方案。以前我已经将 Foo.apk 复制到带有 jarsigner.exe 的目录中并尝试在那里运行它。他提出:
- Set the PATH environment variable so Windows can find the jarsigner executable.
- Move the Foo.apk to the path where the keystore was located.
- Run the command below (without using a path to find the keystore).
- 设置 PATH 环境变量,以便 Windows 可以找到 jarsigner 可执行文件。
- 将 Foo.apk 移动到密钥库所在的路径。
- 运行以下命令(不使用路径来查找密钥库)。
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore .keystore Foo.apk project_foo
It works! Removing the necessity to specify file path for the keystore fixed the problem.
有用!消除为密钥库指定文件路径的必要性解决了该问题。
回答by Dhanashri Dhoke
add release unsigned.apk folder path
添加发布 unsigned.apk 文件夹路径
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore keystorename.keystore .....\platforms\android\build\outputs\apk\android-release-unsigned.apkaliasname
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore keystorename.keystore ..... \platforms\android\build\outputs\apk\android-release-unsigned.apk别名
it's work for me !!
这对我有用!!
回答by The Oathman
If you are trying to sign your .aab or .apk ,from Android Studio but keep getting this error even though you are doing everything right, here is the solution that worked for me: Go to search and find Command Prompt. Run it as Administrator. Now Type this line.
如果您尝试从 Android Studio 签署您的 .aab 或 .apk ,但即使您做的一切都正确,但仍然收到此错误,这是对我有用的解决方案:去搜索并找到命令提示符。以管理员身份运行它。现在输入这一行。
"C:--->Your Path To jarsiner<---\jdk1.8.0_192\bin\jarsigner" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore "C: **--->Your Path To the Keystore<---**\Desktop\OfficalBuilds\MyKey.keystore" "C:**--->Your Path To the .apk Or .aab<---**\Desktop\MyFinalBuild.aab" "My Alias "
If you tried the above solutions,you will notice now the alias is typed inside " ". Also sometime there is a space at the end "My Alias "
如果您尝试了上述解决方案,您会注意到现在别名输入在“”中。有时在“我的别名”末尾还有一个空格