使用Google Play提供的上传密钥对APK进行签名 [英] Signing an APK with an upload key provided by Google Play

查看:1496
本文介绍了使用Google Play提供的上传密钥对APK进行签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解如何在使用Google Play应用签名时将应用上传到Google Play。



以下是我所做的:


  1. 创建应用程序

  2. 使用keytool.exe为该应用程序生成密钥
  3. 将应用上传至Google Play 注册Google Play应用签名

  4. 尝试重新上传应用,但未成功。

它抱怨证书不是证书


将新APK上传至制作中



上传失败
您上传了未使用上传证书签名的APK。您必须使用相同的证书。上传证书的指纹为:
[SHA1:0C:...]
,用于签名您上传的APK的证书有指纹:
[SHA1:2D:...]

搜索一段时间后。我了解如何将我的Google Play控制台上发布的认证信息发布到我的密钥库中。像这样:



keytool.exe -importcert -file upload.pem -keystore myapp-release-key.keystore



keytool.exe -list -keystore trackcoachfull-release- key.keystore
输入密钥库密码:

密钥库类型:JKS
密钥库提供者:SUN

您的密钥库包含2个条目

myappfull,2017年5月18日,PrivateKeyEntry,
证书指纹(SHA1):2D:...
uploadkey,2017年5月19日,trustedCertEntry,
证书指纹(SHA1):0C:...

现在,我被阻塞的地方......



在Android Studio中,我尝试使用uploadkey生成带签名的APK。

生成>生成签名APK
选择$ b $上面的密钥存储区输入密钥存储区密码
选择上传密钥作为密钥别名
我强制输入密钥密码



Android Studio错误:
$ b


错误:任务':app:packageFullRelease'执行失败。


com.android.ide.common.signing.KeytoolException:未能从商店
读取密钥uploadkeyC:\ Users \Admin\AndroidStudioProjects\ keystores \myappfull-release-key.keystore:
受信任的证书条目不受密码保护



我的问题是这样的:



如何使用Google Play提供的上传密钥生成APK?

感谢

解决方案

我可以使用Google Play提供的上传密钥来签署我的APK。以下是我为新应用程序执行的步骤:


  1. 使用Android Studio创建密钥库并添加签名密钥

  2. 使用(1)中创建的密钥对应用程序进行签名
  3. 将APK上传到Google Play
  4. 将上传证书从Google Play控制台

  5. 使用命令
    keytool.exe -importcert -file upload_cert.der -keystore将下载的证书添加到在步骤(1)中创建的密钥存储区< keystorefile>

  6. 它应该提示证书已经存在于别名下的密钥仓库中,你是否还想添加它?[no]:

  7. 输入'y'并按回车


  8. 对于后续版本,请使用(2)中的过程

这里要注意的重要一点是,在步骤(6)中,keytool导入会更新原始证书与从Google Play下载的证书。


I'm trying to make sense of how to upload an app onto Google Play while using Google Play App Signing.

Here is what I did:

  1. Created an app
  2. Used keytool.exe to generate a key for that app
  3. Uploaded the app to Google Play
  4. Enrolled in the Google Play App Signing
  5. Try to upload the app again without success.

It complains that the certificate is not the certificate

Upload new APK to Production

Upload failed You uploaded an APK that is not signed with the upload certificate. You must use the same certificate. The upload certificate has fingerprint: [ SHA1: 0C:... ] and the certificate used to sign the APK that you uploaded have fingerprint: [ SHA1: 2D:... ]

After searching for a while. I find out how to put the certificated posted on my Google Play console in my keystore. Something like this:

keytool.exe -importcert -file upload.pem -keystore myapp-release-key.keystore

The certificate seems to be in. When I list the contents of the keystore, here's what I get:

keytool.exe -list -keystore trackcoachfull-release-key.keystore Enter keystore password:

Keystore type: JKS Keystore provider: SUN

Your keystore contains 2 entries

myappfull, May 18, 2017, PrivateKeyEntry, Certificate fingerprint (SHA1): 2D:... uploadkey, May 19, 2017, trustedCertEntry, Certificate fingerprint (SHA1): 0C:...

Now, where I'm blocked...

In Android Studio, I try to generate a signed APK with the uploadkey.

Build > Generate Signed APK Select the keystore above Enter the keystore password Select the uploadkey as the key alias I'm force to enter a key password.

Error in Android Studio:

Error:Execution failed for task ':app:packageFullRelease'.

com.android.ide.common.signing.KeytoolException: Failed to read key uploadkey from store "C:\Users\Admin\AndroidStudioProjects\keystores\myappfull-release-key.keystore": trusted certificate entries are not password-protected

My question is this:

How do you generate an APK signed with an upload key provided by Google Play?

Thanks

解决方案

I was able to sign my APK using Upload key provided by Google Play. Here are the steps I followed for a new app:

  1. Create a keystore and add a signing key using Android Studio
  2. Sign the app using the key created in (1)
  3. Upload the APK to Google Play
  4. Download "Upload certificate" from Google Play Console
  5. Add downloaded certificate to the keystore created in step (1) using command keytool.exe -importcert -file upload_cert.der -keystore <keystorefile>
  6. It should prompt that "Certificate already exists in keystore under alias . Do you still want to add it? [no]:"
  7. Type 'y' and press enter
  8. A confirmation message will appear
  9. For subsequent builds sign the app using the same process as in (2)

Important point to note here is that in step (6), the keytool import updates the original certificate with the one downloaded from Google Play.

这篇关于使用Google Play提供的上传密钥对APK进行签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆