You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enabling Proguard to reduce the size of the APK (optional)
Proguard is a tool that can slightly reduce the size of the APK. It does this by stripping parts of the React Native Java bytecode (and its dependencies) that your app is not using.
IMPORTANT: Make sure to thoroughly test your app if you've enabled Proguard. Proguard often requires configuration specific to each native library you're using. See app/proguard-rules.pro.
修改文件:android/app/build.gradle
To enable Proguard, edit android/app/build.gradle:
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = true
5. 发布前测试应用是否有问题
react-native run-android --variant=release
5. 生成apk
生成的apk文件在, android/app/build/outputs/apk/ 下
cd android && ./gradlew assembleRelease
6. apk文件位置
android/app/build/outputs/apk
7. 安装apk文件
adb install app-release.apk
app-release 是发布版的apk文件。
The text was updated successfully, but these errors were encountered:
zhongxia245
changed the title
【20161120】ReactNative 打包 Android apk
【20161120】Mac 下 ReactNative 打包 Android apk
Nov 20, 2016
时间:2016-11-20 09:17:07
地址:#52
总结
把JS代码,打包成 index.android.jsbundle
参考文章:ReactNative打离线包-android篇
打包APK
《官网打包APK教程》
一、操作步骤:
1. 生成签名
生成一个有效期10000天的证书,证书为: my-release-key.keystore
不要把证书提交到版本控制系统
2. 配置打包时的签名
把 证书复制到 android/app 目录下
Edit the file ~/.gradle/gradle.properties and add the following (replace ***** with the correct keystore password, alias and key password)
在 gradle.properties 里面添加以下配置
These are going to be global gradle variables, which we can later use in our gradle config to sign our app.
3. 添加签名
Adding signing config to your app's gradle config
Edit the file android/app/build.gradle in your project folder and add the signing config,
修改 android/app/build.gradle 添加签名
4. 减小打包apk的大小
Enabling Proguard to reduce the size of the APK (optional)
Proguard is a tool that can slightly reduce the size of the APK. It does this by stripping parts of the React Native Java bytecode (and its dependencies) that your app is not using.
IMPORTANT: Make sure to thoroughly test your app if you've enabled Proguard. Proguard often requires configuration specific to each native library you're using. See app/proguard-rules.pro.
修改文件:android/app/build.gradle
5. 发布前测试应用是否有问题
5. 生成apk
生成的apk文件在, android/app/build/outputs/apk/ 下
6. apk文件位置
7. 安装apk文件
app-release 是发布版的apk文件。
The text was updated successfully, but these errors were encountered: