将AIR Android p12密钥库文件迁移到Cordova [英] Migrate AIR Android p12 keystore file to Cordova

查看:64
本文介绍了将AIR Android p12密钥库文件迁移到Cordova的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最初的AIR应用程序发布给Android时,我们使用openssl生成了一个.p12密钥库文件.自从我们使用此文件和一个pw对我们的Android应用程序进行签名之后,便将其提交给Google Play商店.我们这样构建apk:

At the time of our initial AIR app for Android release, we generated a .p12 keystore file using openssl, and ever since we have been signing our Android app with this file and a pw before submitting it to the Google Play Store. We build our apk thus:

java adt.jar -storetype pkcs12 -keystore {our-p12} -storepass {our-pw} ....

我们现在正在迁移到科尔多瓦.

We are now migrating to Cordova.

我们已按照此处的说明用.p12签名apk 将p12导入到新的密钥库文件中.我们使用以下命令将p12导入到空的密钥库文件中:

We have imported our p12 into a new keystore file following the instructions here Signing apk with .p12. We use the following command to import our p12 into an empty keystore file:

keytool -importkeystore -srckeystore {our-p12} -destkeystore viacordova.keystore -srcstoretype pkcs12

但是,当我们尝试将Cordova应用程序上传到Google时,会出现以下错误:

However, when we try to upload our Cordova app to Google, we get the following error:

Upload failed

You uploaded an APK that is signed with a different certificate to your previous APKs. You must use the same certificate. Your existing APKs are signed with the certificate(s) with fingerprint(s):

[ SHA1: {list of bytes} ]

and the certificate(s) used to sign the APK you uploaded have fingerprint(s):

[ SHA1: {different list of bytes} ]

推荐答案

如果有人遇到同样的问题,这就是我的解决方法.

If anyone lands here facing the same issue, this is how I solved it.

本质上的问题是,原始.p12文件非常旧(对我而言是2012年),是使用jdk1.7和Adobe Air创建的.使用更高版本的jdk似乎会弄乱指纹.

The issue at heart is that the original .p12 file is super old (2012 for me) and was created with jdk1.7 and adobe air. Using later versions of jdk seem to mess with the fingerprint.

但是我发现您实际上不需要使用现有的.p12做任何事情,但是您确实需要使用jdk1.7来对应用程序进行签名.使用Cordova对应用程序进行签名无法正常工作,并且会抱怨.p12

However I discovered you don't actually need to do anything with your existing .p12 but you do need to use jdk1.7 to sign the app. Using Cordova to sign the app won't work and will complain about the .p12

以下步骤允许我签署我的Cordova Android应用程序,并使用adobe air创建的现有.p12证书成功将其提交为Google Play上的更新.

The below steps allowed me to sign my Cordova Android app and successfully submit it as an update on google play with an existing .p12 cert created with adobe air.

首先使用最新的Cordova和依赖项等为您的android应用构建未签名的发行版.

First build an unsigned release version of your android app using latest Cordova and dependencies etc.

cordova build android --release

导航到jdk1.7 bin目录,在我的Windows上是:C:\ Program Files \ Java \ jdk1.7.0_03 \ bin,现在使用jdk1.7 jarsigner签名您的应用.

Navigate to a jdk1.7 bin directory, in my case on windows it was: C:\Program Files\Java\jdk1.7.0_03\bin and now sign your app with jdk1.7 jarsigner.

jarsigner -keystore PATH_TO/your_original.p12 -storetype pkcs12 PATH_TO/app-unsigned.apk 1

现在,您只需要在此命令中使用zipalign.在Android \ Sdk \ build-tools中使用最新的zipalign可以正常工作.

Now you just need to use zipalign with this command. Using latest zipalign in Android\Sdk\build-tools works OK.

zipalign -f -v 4 app-unsigned.apk app-signed.apk

现在,您可以将.apk上传到Google Play商店.

Now you can upload your .apk to google play store.

相关(但对我来说仍然以错误的指纹结尾):签名带有Adobe Air证书的Android Native apk

Related (but still ended in wrong fingerprint for me): Sign Android Native apk with Adobe Air certificate

这篇关于将AIR Android p12密钥库文件迁移到Cordova的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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