指定签名配置的摇篮和科尔多瓦5 [英] Specify signing config for Gradle and Cordova 5

查看:124
本文介绍了指定签名配置的摇篮和科尔多瓦5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在对应科尔多瓦新闻 5.0.0版本已经准备就绪。我想升级我的所有的Andr​​oid项目,就像是一般。

In correspondence with Cordova news version 5.0.0 is ready. I tried to upgrade all my Android projects like it was usually.

要更新科尔多瓦框架本身:

To update Cordova framework itself:

npm update -g cordova

要更新的Andr​​oid项目库:

To update library in Android project:

cordova platform update android

使用--release选项构建新版本后:

After building new version using "--release" option:

cordova build android --release

我只拿到了签名版本。奇怪...
那么怎么可能重用现有的密钥库(由keytool的pviously产生和使用的科尔多瓦4.0.0 $ P $)得到签名的APK?

I got only unsigned version. Strange...
So how is it possible to reuse existing keystore (previously generated by keytool and used by Cordova 4.0.0) to get signed APK?

推荐答案

看起来科尔多瓦5.0.0 使用摇篮构建自动化系统而不是蚂蚁。 /platforms/android/ant.properties不会被建设过程中使用,因此原来的设置文件中定义密钥库中。因此,我们将得到的无符号APK结果。

It looks like Cordova 5.0.0 uses Gradle build automation system instead of Ant. So original settings for keystore defined in the file "/platforms/android/ant.properties" will not be used during building. So we will get unsigned APK as a result.

要解决这个问题,我们需要告诉摇篮使用现有的密钥库也是如此。 build.gradle的研究为我们提供了我们需要提供signingConfigs有用的信息。

To solve this issue we need to tell Gradle to use existing keystore as well. Investigation of build.gradle gives us useful information that we need to provide signingConfigs.

但它是坏主意,这样做,在这个文件中,因为它被标记为自动生成的,它应该是没有任何编辑。

But it is bad idea to do that in this file because it is labelled as auto-generated and it should be free of any editing.

所以,最后我已经找到了解决问题的方法。对象signingConfigs将被从文件中构造与文件名保存在 cdvReleaseSigningPropertiesFile 的。对应于文件这个变量的默认值是 release-signing.properties 的。因此,我们只需要在同一个文件夹中创建这样的名称新文件保存为的 build.gradle 的文件,并把下面的内容中:

So finally I have found the way to solve it. Object "signingConfigs" will be constructed from file with filename stored in cdvReleaseSigningPropertiesFile. In correspondence with documentation the default value of this variable is "release-signing.properties". So we need just to create new file with such name in the same folder as "build.gradle" file and put inside the following content:

storeFile=..\\..\\some-keystore.keystore
storeType=jks
keyAlias=some-key
// if you don't want to enter the password at every build, you can store it with this
keyPassword=your-key-password
storePassword=your-store-password

例如,在路径中指定的密钥库保存在项目的根目录。它的Windows风格......如果Linux的,你需要(在上面的例子中没有使用双反斜线等)使用单一的斜线。

Path in example is specified for keystore saved in the project root directory. It has Windows style... In case of Linux you will need to use single slashes (not double backslashes like in above example).

另外,你可以设置自己的路径签名设置文件。 要了解更多关于检查科尔多瓦文档边缘的版本。

In addition you can set your own path for signing settings file. To read more about that check the edge version of cordova documentation.

这篇关于指定签名配置的摇篮和科尔多瓦5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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