我正在尝试在我的mac中从cordova构建签名应用程序。每当我运行cordova build android--release
时,它都会释放未签名的apk。
我已经在Play商店创建了帐户。我还检查了多个链接以使此工作。
如何创建一个签名的APK文件使用科尔多瓦命令行界面?
http://cordova.apache.org/docs/en/6.x/guide/platforms/android/index.html#signing-an-app
我很少关注密钥文件。
根据Cordova留档,我们可以使用build. json
或Gradle来构建签名的apk。
{
"android": {
"debug": {
"keystore": "../android.keystore",
"storePassword": "android",
"alias": "mykey1",
"password" : "password",
"keystoreType": ""
},
"release": {
"keystore": "../android.keystore",
"storePassword": "",
"alias": "mykey2",
"password" : "password",
"keystoreType": ""
}
}
}
上面的代码来自科尔多瓦网站,但我找不到build. json文件。
这是gradle的代码。
You can also specify signing properties by including a .properties file and pointing to it with the cdvReleaseSigningPropertiesFile and cdvDebugSigningPropertiesFile Gradle properties (see Setting Gradle Properties). The file should look like this:
storeFile=relative/path/to/keystore.p12
storePassword=SECRET1
storeType=pkcs12
keyAlias=DebugSigningKey
keyPassword=SECRET2
storePassword and keyPassword are optional, and will be prompted for if omitted.
但我不确定从哪里可以得到详细信息,如存储密码KeyPassword DebugSigningKey。
我正在使用最新版本的科尔多瓦,7.0.1。
你只能得到一个未签名的APK,因为gradle找不到用于签名应用的密钥库。
要解决此问题,您需要执行以下操作(这就像您在Windows中所做的那样,在Mac上应该相同):
>
keytools-genkey-v-keystore C:\mykeystore\CordovaRelease. keystore-alias CordovaRelease-keyalgRSA-keysize 2048-有效性10000的东西创建密钥库
请确保您安装了JRE。在Cordova项目文件夹中创建build. json文件并引用密钥库,如下所示
"android": {
"debug": {
"keystore": "..\mykeystore\CordovaDebug.keystore",
"storePassword": "secretpassword",
"alias": "CordovaDebug",
"password" : "secretpassword",
"keystoreType": ""
},
"release": {
"keystore": "..\mykeystore\CordovaRelease.keystore",
"storePassword": "",
"alias": "CordovaRelease",
"password" : "secretpassword",
"keystoreType": ""
}
}
相对路径从您的Cordova项目文件夹到keystore文件夹。
希望这有帮助。