Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Generate APK React Native
- B1: Tao key
- keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 20000
- B2: Edit the file ~/.gradle/gradle.properties or android/gradle.properties and add the following (replace ***** with the correct keystore password, alias and key password),
- MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
- MYAPP_RELEASE_KEY_ALIAS=my-key-alias
- MYAPP_RELEASE_STORE_PASSWORD=*****
- MYAPP_RELEASE_KEY_PASSWORD=*****
- B3:
- Edit the file android/app/build.gradle in your project folder and add the signing config
- android {
- ...
- defaultConfig { ... }
- signingConfigs {
- release {
- if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
- storeFile file(MYAPP_RELEASE_STORE_FILE)
- storePassword MYAPP_RELEASE_STORE_PASSWORD
- keyAlias MYAPP_RELEASE_KEY_ALIAS
- keyPassword MYAPP_RELEASE_KEY_PASSWORD
- }
- }
- }
- buildTypes {
- release {
- ...
- signingConfig signingConfigs.release
- }
- }
- }
- ...
- B4:
- Sua Build.gradle (Module: app)
- buildTypes {
- release {
- signingConfig signingConfigs.release //Cho them dong nay
- minifyEnabled enableProguardInReleaseBuilds
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
- }
- }
- B5: Chay Bundle
- react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
- B6: Tao APK
- cd android && ./gradlew assembleRelease
- cd android && ./gradlew bundleRelease
- B7: Apk located
- android/app/build/outputs/apk/app-release.apk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement