简体   繁体   English

Phonegap在本地构建发布版本(没有Phonegap Build)

[英]Phonegap build release version locally (without Phonegap Build)

i recently finished working on my first hybrid app project with phonegap. 我最近完成了第一个带有phonegap的混合应用项目。 when it came to the open beta test i was a bit scared of the signing process. 当谈到公开测试时,我有点害怕签名过程。 i read many different snippets of advice from here but also from other places in the net to get that work. 我从这里读到了许多不同的建议,但也从网上的其他地方读到了这些建议。

following is a step by step how to build and correctly sign a release version for the release in google play store. 以下是如何在Google Play商店中为该版本构建和正确签署发布版本的步骤。

hope that it helps you. 希望它能帮助你。 cheers 干杯


Phonegap Signing and Release Process Phonegap签名和发布流程

before you start: 在你开始前:

  • make sure you have the java jdk in your $JAVA_HOME path to check it type $JAVA_HOME in your terminal and check the path for correct java path 确保在$ JAVA_HOME路径中有java jdk来检查它在终端中键入$ JAVA_HOME并检查路径是否有正确的java路径
  • open the androidMainfest.xml from your android project and change android:debuggable in the application -tag to false 从你的android项目打开androidMainfest.xml并将应用程序 -tag中的android:debuggable更改为false

1. generate a private key 1.生成私钥

create a private key (Dont Loose it, ever!) - i save the key in my personal .ssh folder so all keys are at the same place - it will ask you for a password and some personal details - make sure to replace [key_name] and [key_alias] with your keystorename and and alias (dont loose that either!) 创建一个私钥(永远不要松散!) - 我将密钥保存在我的个人.ssh文件夹中,这样所有密钥都在同一个地方 - 它会要求您输入密码和一些个人信息 - 确保替换[key_name] ][key_alias]与你的keystorename和别名(也不要松散!)


cd /Users/[username]/.ssh
keytool -genkey -v -keyalg RSA -keystore [key_name].keystore -alias [key_alias] -keysize 2048 -validity 50000

  • To Store the path to your keystore file and the key_alias for later use in this project create a new ant.properties file in the platforms/android folder and put in this: (change your [username], [key_name] and [key_alias] accordingly 要存储密钥库文件的路径和key_alias以供以后在此项目中使用,请在platforms / android文件夹中创建一个新的ant.properties文件并输入:(相应地更改[username],[key_name]和[key_alias]

[ant.properties] file [ant.properties]文件


key.store=/Users/[username]/.ssh/[key_name].keystore
key.alias=[key_alias]

2. build the release-unsigned.apk 2.构建release-unsigned.apk

  • change to the platforms android directory of your app and rund the ant comment 更改到您的应用程序的平台android目录并退出ant评论

cd platforms/android
ant release

3. signing the apk 3.签署apk

  • make sure to replace [username] with your username 确保用您的用户名替换[username]
  • replace [key_name] and [key_alias] with the key details (from step 1) 用密钥详细信息替换[key_name][key_alias] (从步骤1开始)
  • replace [appname] with the name of the ...-release-unsigned.apk [appname]替换为...- release-unsigned.apk的名称
  • you will be asked for your keystore password (set in step 1) 系统将要求您输入密钥库密码(在步骤1中设置)

jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore /Users/[username]/.ssh/[key_name].keystore [appname]-release-unsigned.apk [key_alias]

4. create final release apk 4.创建最终版本apk

  • replace [appname] with your appname and build the final release file 用您的appname替换[appname]并构建最终版本文件

zipalign -v 4 [appname]-release-unsigned.apk [appname].apk

5. Load up your final release to google playstore 5.将最终版本加载到google playstore

The final app release is now found in the bin folder of your android project its named [appname].apk upload that file with the google play developer console ( https://play.google.com/apps/publish ) 最终的应用程序版本现在位于您的Android项目的bin文件夹中,其名为[appname] .apk上传该文件与google play开发者控制台( https://play.google.com/apps/publish

create a google group or google+ group and name it as the alpha/beta test group for your app. 创建一个谷歌群组或谷歌+组,并将其命名为您的应用程序的alpha / beta测试组。 every person that is in this group can see your test version in the appstore and install it. 该组中的每个人都可以在appstore中查看您的测试版本并进行安装。 Very handy tool instead of the complicated process for ios. 非常方便的工具,而不是复杂的ios过程。

happy testing :) 快乐测试:)

...don't forget to minify your code as best you can and remove console logging on a release build ...不要忘记尽可能地缩小代码并删除发布版本上的控制台日志记录

http://jscompress.com/ http://jscompress.com/

https://developers.google.com/closure/compiler/ https://developers.google.com/closure/compiler/

http://closure-compiler.appspot.com/home http://closure-compiler.appspot.com/home

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM