打包配置确认流程
config.js版本号 与 环境
- bundleMinVersion + 1
- 测试环境release包 与 正式环境release包 对应环境域名
配置热更新服务器环境,区分环境,nativeConfig.js ->
buildConfig.DEBUG ? “http://**-test.com:3000” : “http://**-pro.com:3000”热更新服务器登录切换 code-push whoami
测试环境 http://**-test.com:3000
正式环境 http://**-pro.com:3000
run-android发布
1 | react-native run-android // debug包 |
生成bundle包
1 | react-native bundle --platform android --entry-file index.js --bundle-output ./bundles/index.android.bundle --assets-dest ./bundles --dev false |
- 调试环境 –dev true;正式环境 –dev false
提交bundle包到code-push,发布更新
获取登录的token
http://**-test.com:3000
用户名:admin
密码:**登录到code-push-server
1
code-push login http://******-test.com:3000
token 复制 1)中获取的 token
- code-push相关命令
查看 app
code-push app ls
查看 Deployment Key
code-push deployment ls 组局游戏-android -k
- 执行code-push release命令
1 | code-push release "组局游戏-android" ./bundles/ 0.0.3 --deploymentName Production --description "version=8" --mandatory false |
1 | code-push history deployment "组局游戏-android" Production // 查看历史版本 |
混淆代码
启用Proguard代码混淆来缩小APK文件的大小
1 | def enableProguardInReleaseBuilds = true |