1、全局安装cordova
npm install -g cordova
2、创建项目
cordova create cordova-demo com.example.cordovaDemo cordovaDemo
3、添加平台
cordova platform add android
4、构建apk
cordova build android
5、查看apk 目录
platforms/android/app/build/outputs/apk
构建release版本
build
cordova build --release
sign
keytool -genkey -v -keystore release-key.keystore -alias cordova-demo -keyalg RSA -keysize
2048 -validity 10000
对APK 签名
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore release-key.keystore
android-apk/android-release-unsigned.apk cordova-demo
自动打包
cordova build android --release -- --keystore="release-key.keystore" --alias=cordova-demo --
storePassword=testing --password=testing2
文件内容
如下
{
"android": {
"release": {
"keystore": "release-key.keystore",
"alias": "cordova-demo",
"storePassword": "testing",
"password": "testing2"
}
}
}
网友评论