└── README.md /README.md: -------------------------------------------------------------------------------- 1 | > The instructions are the collective efforts from a few places online. 2 | Nothing here is my original. But I want to put them together in one place to save people from spending the same time. 3 | 4 | First off, bundle. 5 | ================== 6 | 7 | 1. Go to the project directory cd 8 | 2. Start the react-native packager if not started 9 | 3. Download the bundle to the asset folder: 10 | 11 | ```sh 12 | $ curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" 13 | ``` 14 | (Thanks : https://github.com/facebook/react-native/issues/2743#issuecomment-140697340) 15 | 16 | Note: make sure there is assets folder under android/app/src/main beforehand, and check if there is any error in the packager terminal window after curl. 17 | 18 | Secondly, compile release version. 19 | ================================== 20 | 21 | 1. cd to {YOUR_PROJECT}/android 22 | 2. Build release version 23 | ```sh 24 | $ ./gradlew assembleRelease 25 | ``` 26 | 27 | Thirdly, sign the apk. 28 | ====================== 29 | 30 | 1. To generate keystore 31 | ```sh 32 | $ keytool -genkey -v -keystore my-keystore.keystore -alias name_alias -keyalg RSA -validity 10000 33 | ``` 34 | 2. To sign an apk 35 | ```sh 36 | $ jarsigner -verbose -keystore alias_name 37 | ``` 38 | 3. To zip align an apk 39 | ```sh 40 | $ zipalign -f -v 4 41 | ``` 42 | (Thanks : http://stackoverflow.com/questions/26828372/how-to-sign-a-modded-an-apk-on-a-mac-with-apktool) 43 | 44 | Lastly, install apk to device. 45 | ============================== 46 | 47 | 1. Connect your phone to computer 48 | 2. Install apk 49 | ```sh 50 | $ adb install {PATH_TO_APK} 51 | ``` 52 | 53 | > Visit http://facebook.github.io/react-native/docs/signed-apk-android.html for more details on generating signed APK 54 | 55 | --------------------------------------------------------------------------------