Skip to content

Instantly share code, notes, and snippets.

@gorrotowi
Last active February 23, 2017 22:25
Show Gist options
  • Save gorrotowi/012bb1410f21133f0e7f9a3411421030 to your computer and use it in GitHub Desktop.
Save gorrotowi/012bb1410f21133f0e7f9a3411421030 to your computer and use it in GitHub Desktop.
Commands to build a signed APK in terminal for react_native project
#start react-native in port 8088
$ react-native start --port=8088
#download the bundle of android know bug in react-native
$ curl http://localhost:8088/index.android.bundle?platform=android
#inside react-native's android project build the assembleRelease flavor
$ ./gradlew assembleRelease
#go to the apk's android folder
$ cd app/build/outputs/apk/
#Use zipalign from build-tools of your prefer android API version
# $ <AndroidSDKBuildTools>/zipalign -v -p 4 <apkunsigned> <nameNewApk>
$ /Users/Gorro/Library/Android/sdk/build-tools/25.0.0/zipalign -v -p 4 app-release.apk app.apk
#Use apksigner from build-tools of your prefer android API version
# $ <AndroidSDKBuildTools>/apksigner sign --ks <AndroidkeystoreDirectory>/app.keystore <apkToSign>
$ /Users/Gorro/Library/Android/sdk/build-tools/25.0.0/apksigner sign --ks /Volumes/TowiHD/Repos/SAP/android/app/SAPRelease.keystore app.apk
#Verify the output apk
# $ <AndroidSDKBuildTools>/apksigner verify <apk>
$ /Users/Gorro/Library/Android/sdk/build-tools/25.0.0/apksigner verify app.apk
#User jarsigner to sign the jar/apk
# $ jarsigner -verbose -keystore <AndroidkeystoreDirectory>/app.keystore <apkToSign> <KeystoreAlias>
$ jarsigner -verbose -keystore /Volumes/TowiHD/Repos/SAP/android/app/SAPRelease.keystore app.apk SAPRelease
#Re zipalign to upload to playstore
/Users/Gorro/Library/Android/sdk/build-tools/25.0.0/zipalign -v -p 4 app.apk app_release_signed.apk
#install the apk to verify the app
# $ adb install <apk>
$ adb install app.apk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment