建设Cordova版本apk

时间:2015-06-25 19:36:43

标签: android cordova

根据新的cordova 5.0指南,我发现我很难听到我的应用程序签名

这就是我所做的

SimpleBuildStep.perform

这就是我在build.json文件中的内容

(bongoapp)project root
 ->build.json
 ->phistoKey.keystore
 ->www

}

当我尝试

{
 "android": {
     "release": {
         "keystore": "phistoKey.keystore",
         "storePassword": "",
         "alias": "phistoKey",
         "password" : "",
         "keystoreType": ""
     }
 }

cordova build --release

我收到错误陈述

cordova build android --release

如果有人能帮助我,我将很高兴我今天的截止日期。谢谢

3 个答案:

答案 0 :(得分:2)

我在新的Cordova CLI(使用gradle)中执行此操作的方式是使用cordova提供的选项,而无需创建我们自己的脚本或在不同的步骤中手动执行。就我而言,我在platforms/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,它将在您的输出目录(platforms/android/outputs/apk/yourapp-release.apk)中生成新版本APK

答案 1 :(得分:0)

我在shell脚本中执行以下操作来构建和签署APK。这假定应用程序名为“bongoapp”,并且您的Cordova项目和密钥库文件(phistoKey.keystore)与shell脚本位于同一文件夹中。

# 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"

答案 2 :(得分:0)

在cordova 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