Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy/Publish Android app made with React Native

How can I deploy and publish an Android app made with React Native to Google Play?

like image 428
John Victor Avatar asked Sep 25 '15 13:09

John Victor


2 Answers

Steps:

  1. Create and then copy a keystore file to android/app keytool -genkey -v -keystore mykeystore.keystore -alias mykeyalias -keyalg RSA -keysize 2048 -validity 10000
  2. Setup your gradle variables in android/gradle.properties MYAPP_RELEASE_STORE_FILE=mykeystore.keystore MYAPP_RELEASE_KEY_ALIAS=mykeyalias MYAPP_RELEASE_STORE_PASSWORD=***** MYAPP_RELEASE_KEY_PASSWORD=*****
  3. Add signing config to android/app/build.gradle defaultConfig { ... } signingConfigs { release { 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 } }
  4. Generate your release APK cd android && ./gradlew assembleRelease
  5. Upload android/app/build/outputs/apk/app-release.apk to Google Play

Resource: React Native Publishing an Android App

like image 59
Tyler Buchea Avatar answered Oct 21 '22 05:10

Tyler Buchea


What you want to do is creating a javascript bundle and after that compile the app using gradle. Currently(react-native v0.11) the bundle command only supports generating iOS bundles.

I found a description how to get the android bundle and generate an APK. See https://github.com/facebook/react-native/issues/2712 or https://github.com/facebook/react-native/issues/2743#issuecomment-140697340

Hope this helps.

-- Edit as of 2016 25th of May (v0.26.1 as stable)

Currently it's pretty easy to generate a production APK.

cd android ./gradlew assembleRelease

And now you should have a production APK. You should be able to sign the APK http://facebook.github.io/react-native/docs/signed-apk-android.html#content

like image 22
Tim Avatar answered Oct 21 '22 05:10

Tim