22

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

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
John Victor
  • 221
  • 1
  • 2
  • 3

6 Answers6

18

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

Tyler Buchea
  • 1,642
  • 3
  • 17
  • 25
  • in **step 2** are we creating a new `gradle.properties` file in `.gradle` because one `gradle.properties` file already exists in the `android` root folder. Thanks – Kenshinman Jun 10 '17 at 09:14
  • 1
    You should use the `gradle.properties` file in the root android folder for **Step 2** and you should not create a new `gradle.properties` file. The location of this file has changed since I originally wrote this answer. Sorry for the confusion. I will update my answer. – Tyler Buchea Jun 12 '17 at 18:59
4

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

Tim
  • 599
  • 5
  • 15
2

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.

Kashif Anwaar
  • 728
  • 7
  • 14
  • Publishing in the play store is not react-native specific. Once you have an signed APK (which RN docs have a guide for) it's the same process as any other Android app. – Christopher Reid Jun 22 '16 at 23:15
2

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

Hpatoio
  • 1,785
  • 1
  • 15
  • 22
1

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

herbertD
  • 10,657
  • 13
  • 50
  • 77
0

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.