我发现在新的cordova 5.0指南下签署我的应用程序非常困难
这就是我所做的
(bongoapp)project root
->build.json
->phistoKey.keystore
->www
这是我在build. json文件中的内容
{
"android": {
"release": {
"keystore": "phistoKey.keystore",
"storePassword": "",
"alias": "phistoKey",
"password" : "",
"keystoreType": ""
}
}
}
当我尝试
cordova build --release
或
cordova build android --release
我得到错误陈述
Keystore file does not exist: C:\wamp\www\towncrier\platforms\android\..\..\phistoKey.keystore
如果有人能帮忙,我会很高兴,因为我今天快到截止日期了。谢谢
我在新科尔多瓦CLI(使用gradle)中的做法是使用科尔多瓦给我们的选项来执行此操作,而无需制作自己的脚本或在不同步骤中手动执行。在我的例子中,我在平台/android
目录中创建了一个文件,名称为release-signing.properties
。其中的内容应该是签名apk的配置,类似于:
key.store=/PATH/TO/YOUR/KEYSTORE
key.alias=your_alias
key.store.password=key_store_pass
key.alias.password=key_store_alias
创建此文件后,您只需运行标准命令cordova build android--release
,它将在您的输出目录中生成新的发布APK(平台/android/输出/apk/yourapp-release. apk
)
在科尔多瓦6.2.0
cd cordova/ #change to root cordova folder
platforms/android/cordova/clean #clean if you want
cordova build android --release -- --keystore="/path/to/keystore" --storePassword=password --alias=alias_name #password will be prompted if you have any
我在外壳脚本中执行以下操作来构建和签署APK。这假设应用程序名为“bongoapp”,并且您的Cordova项目和密钥库文件(phistoKey. keystore)位于与外壳脚本相同的文件夹中。
# Run this script in the bongoapp folder to build and sign a release APK.
# Hint: the password is "bongoapp"
# Build the release APK
echo "Building Android release APK"
cordova build android --release
# Sign the APK
echo "Signing Android release APK"
jarsigner -verbose -certs -sigalg SHA1withRSA -digestalg SHA1 -keystore phistoKey.keystore platforms/android/ant-build/MainActivity-release-unsigned.apk bongoapp_alias
jarsigner -verbose -certs -verify platforms/android/ant-build/MainActivity-release-unsigned.apk
zipalign -v 4 platforms/android/ant-build/MainActivity-release-unsigned.apk platforms/android/ant-build/bongoapp.apk
echo "Done, output file is located here -> platforms/android/ant-build/bongoapp.apk"