Ionic3打包
我打包的时候遇到的问题全部都是版本不兼容的问题,没有这个问题的小婊贝们就可以直接退出啦~
ionic cordova build android --release
(遇到的问题:
1.报错read ECONNREST 回退ionic版本 将4版本降为3.5.0
2.报错env.runcmd is not a funtion 回退cli版本
npm install @ionic/cli-plugin-cordova@1.4.0
再报错 就cnpm install @ionic/cli-plugin-cordova@1.4.0
)
3.报错 A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
打开“工程名/platforms/android/CordovaLib”目录下的build.gradle文件,注释掉buildscript中的dependencies中的classpath 'com.android.tools.build:gradle:3.0.1'
4.报错Execution failed for task ':app:processDebugManifest'
整个错误是这样的
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library
[:CordovaLib]ted ...
E:\Baosight\ionic3\platforms\android\CordovaLib\build\intermediates\manifests\full\debug\AndroidManifest.xml as
the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="org.apache.cordova" to force usage
搜索minSdkVersion 将其版本号全部改为19
然后终于打包成功了~鸡冻
然后是签名文件的问题了
ionic3的release版本在手机上是不能安装的,debug版本可以
第一步:
keytool -genkey -alias demo.keystore -keyalg RSA -validity 40000 -keystore demo.keystore
这一步应该是不需要的 。。
第二步:
keytool -genkey -alias xxq -keyalg RSA -validity 40000 -keystore demo.keystore
1.在platforms\android目录下新建名为release-signing.properties的文件
文件内容如下
storeFile=demo.keystore //密钥库位置
keyAlias=xxq //别名 ,一定要和第一步别名一样
storePassword=12121p
keyPassword=12121p
2.把上一步生成的demo.keysrore 移动到 platforms\android下
第二步借鉴的是这个大佬的https://www.jianshu.com/p/2f93116e7e8e
第三步:
jarsigner -verbose -keystore ./demo.keystore -signedjar demo_signed.apk app-release-unsigned.apk demo.keystore
PS: ./demo.keystore为之前生成的证书
app-release-unsigned.apk demo.keystore都放在项目目录文件下 ./为路径
最后
ionic cordova build android --release