Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. Generate APK React Native
  2. B1: Tao key
  3. keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 20000
  4.  
  5. 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),
  6. MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
  7. MYAPP_RELEASE_KEY_ALIAS=my-key-alias
  8. MYAPP_RELEASE_STORE_PASSWORD=*****
  9. MYAPP_RELEASE_KEY_PASSWORD=*****
  10.  
  11. B3:
  12. Edit the file android/app/build.gradle in your project folder and add the signing config
  13.  
  14. android {
  15.  
  16. ...
  17. defaultConfig { ... }
  18. signingConfigs {
  19. release {
  20. if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
  21. storeFile file(MYAPP_RELEASE_STORE_FILE)
  22. storePassword MYAPP_RELEASE_STORE_PASSWORD
  23. keyAlias MYAPP_RELEASE_KEY_ALIAS
  24. keyPassword MYAPP_RELEASE_KEY_PASSWORD
  25. }
  26. }
  27. }
  28. buildTypes {
  29. release {
  30. ...
  31. signingConfig signingConfigs.release
  32. }
  33. }
  34. }
  35. ...
  36.  
  37.  
  38.  
  39. B4:
  40.  
  41. Sua Build.gradle (Module: app)
  42.  
  43. buildTypes {
  44. release {
  45. signingConfig signingConfigs.release //Cho them dong nay
  46. minifyEnabled enableProguardInReleaseBuilds
  47. proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  48. }
  49. }
  50. B5: Chay Bundle
  51. 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/
  52. B6: Tao APK
  53. cd android && ./gradlew assembleRelease
  54. cd android && ./gradlew bundleRelease
  55.  
  56.  
  57. B7: Apk located
  58. android/app/build/outputs/apk/app-release.apk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement