deployment – Deploy/Publish Android app made with React Native-ThrowExceptions

Exception or error:

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

How to solve:

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

###

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

###

React Native is very new in the market, the only guide for android is it’s official guide

https://facebook.github.io/react-native/docs/android-setup.html

it’ll take time for people to learn & write tutorials for it.

Once you’ve followed the guide, you can create & run app easily. but there is no mention of publishing in play store officially as of now. wait for some time, they’ll tell you soon.

###

The official documentation has been updated. Look here:
http://facebook.github.io/react-native/docs/signed-apk-android.html#content

###

As Fackbook hasn’t released formal Android deploy method, Try Microsoft Code push to deploy your Android project.

###

I wrote a tool with some of my colleagues to help setup React Native for deployment. It sets up Fastlane with multiple environments and centralizes the multiple configurations files.

It consists of multiple generators but the ones you will be interested most with are rn-toolbox:fastlane and rn-toolbox:assets (you will need the icons to publish).

We summarised the contents here and you can find the tool on npm

You will still need an Apple Developer account and Android Developer account but this should help you getting to prod quickly.

Leave a Reply

Your email address will not be published. Required fields are marked *