问题描述
我使用的是Android Studio构建我的Android项目,当我上传我的APK到谷歌播放,它让我看这个错误,尽管使用的相同的密钥库这是我使用的较早的我的应用程序版本:
首先,这是不可能的谷歌Play是错在这里。你确定你没有错误使用调试的关键?
检查使用的签名密钥
您应该仔细检查该证书老APK和新的APK包含,使用以下命令:
的jarsigner -verify -verbose:总结-certs old.apk
的jarsigner -verify -verbose:总结-certs new.apk
这说明你对每个APK签署的文件,像这样的信息:
SM 4642892周四04月17日10点57分44秒CEST 2014年classes.dex(412以上)
X.509,CN =我的应用程序,O =我的公司,C = DE,L =科隆
[证书的有效期为13年11月11日12:12至29/03/41 12:12]
[证书路径不验证:路径不链条与任何信任锚]
如果新的APK说 X.509,CN = Android的调试,O =的Android,C = US
,那么你已经签署了APK与调试的关键,而不是原始版本的关键。
如果该X.509标识字符串在其他方面有所不同,或证书日期是两个之间的APK不同,你刚刚证实,你做的不可以使用相同的签名密钥进行的APK。
您可以忽略任何证书路径不验证的字样;它不是相应于这种情况。
搜索原始密钥库
如果证书信息是不同的,你需要找到原来的密钥库,即与第一SHA1值,谷歌播放告诉你该文件。
通过搜索所有的密钥库文件中,你可以找到,直到你有一个与正确的选择SHA1指纹:
的keytool -list -keystore我,release.keystore
我找不到原来的密钥库
如果您无法找到原来的密钥库,你会永远可以发布任何更新到这个特殊的应用程序。
Android的提到了这一点明确的签署您的应用程序页:
的APK的第一个版本后,所有的后续版本必须具有完全相同的密钥签名。
我可以提取原APK原来的签名密钥?
没有。这是不可能的。本APK只包含公开信息,而不是你的私有密钥信息。
我可以迁移到一个新的签名密钥?
没有。即使你发现,原来,你不能签署密钥A的APK,然后签订两个键A和B的下一个更新,再签收只用密钥B的下一个更新。
签名的APK(或JAR文件)有多个键的技术上的可能,但谷歌播放不接受的APK与多个签名。
我该怎么办?
您将有一个新的应用程序ID构建你的应用程序(例如,从com.example.myapp到com.example.myapp2的变化),并在谷歌创建一个品牌新上市的播放。
也许你也将不得不改变你的code,使人们可以安装新的应用程序,即使他们有旧的应用程序安装,如:你需要确保你没有冲突的内容提供商。
您将失去现有的安装基础,评论等,必须找到一个办法让你的老客户卸载旧的应用程序,并安装新版本。
再次确保你有使用这个版本的密钥库和密码的备份。
I'm using Android Studio to build my Android projects and, when I upload my APK to Google Play, it keeps showing me this error in spite of using the same keystore which I used for earlier versions of my app:
Firstly, it's unlikely that Google Play is wrong here. Are you sure you didn't use your debug key by mistake?
Check the signing keys used
You should double-check which certificates the old APK and new APK contain, with the commands:
jarsigner -verify -verbose:summary -certs old.apk
jarsigner -verify -verbose:summary -certs new.apk
This shows you information about the files signed in each APK, like this:
sm 4642892 Thu Apr 17 10:57:44 CEST 2014 classes.dex (and 412 more)
X.509, CN=My App, O=My Company, C=DE, L=Köln
[certificate is valid from 11/11/13 12:12 to 29/03/41 12:12]
[CertPath not validated: Path does not chain with any of the trust anchors]
If the new APK says X.509, CN=Android Debug, O=Android, C=US
, then you have signed the APK with your debug key instead of the original release key.
If the X.509 identity strings are otherwise different, or the certificate dates are different between the two APKs, you've just confirmed that you did not use the same signing key for both APKs.
You can ignore any "CertPath not validated" message; it's not relevant in this case.
Search for the original keystore
If the certificate information is different, you need to find the original keystore, i.e. the file with the first SHA1 value that Google Play told you.
Search through all the keystore files you can find until you have the one with the correct SHA1 fingerprint:
keytool -list -keystore my-release.keystore
I can't find the original keystore
If you cannot find the original keystore, you will never be able to publish any updates to this particular app.
Android mentions this explicitly on the Signing Your Application page:
After the first release of an APK, all subsequent releases must be signed with the exact same key.
Can I extract the original signing key from the original APK?
No. This is not possible. The APK only contains public information, and not your private key information.
Can I migrate to a new signing key?
No. Even if you do find the original, you can't sign an APK with key A, then sign the next update with both keys A and B, then sign the next update with only key B.
Signing an APK (or any JAR file) with multiple keys technically possible, but Google Play does not accept APKs with multiple signatures.
What can I do?
You will have to build your app with a new application ID (e.g. change from "com.example.myapp" to "com.example.myapp2") and create a brand new listing on Google Play.
Possibly you will also have to change your code so that people can install the new app even if they have the old app installed, e.g. you need to make sure that you don't have conflicting content providers.
You will lose your existing install base, reviews etc., and will have to find a way to get your existing customers to uninstall the old app and install the new version.
Again, ensure you have backups of the keystore and password you use for this version.
这篇关于由于不同的证书不能上传更新的APK到谷歌播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!