Disclaimer: The instructions are the collective efforts from a few places online. Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
- cd to the project directory
- Start the react-native packager if not started
- Download the bundle to the asset folder: curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
(Credit: facebook/react-native#2743 (comment))
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.
- cd to {YOUR_PROJECT}/android
- ./gradlew assembleRelease
-
To generate keystore keytool -genkey -v -keystore my-keystore.keystore -alias name_alias -keyalg RSA -validity 10000
-
To sign an apk jarsigner -verbose -keystore alias_name
-
To zip align an apk zipalign -f -v 4 <your.apk > <your_aligned.apk>
(Credit: http://stackoverflow.com/questions/26828372/how-to-sign-a-modded-an-apk-on-a-mac-with-apktool)
- connect your phone to computer
- adb install {PATH_TO_APK}