2

I have been learning React Native for a while by watching video tutorials. The instructors are teaching how to code and run the project in simulator but no one ever mentioned or showed how to publish the local projects as a production app. I researched and checked official React Native documentation but I could not figure out how to publish

The question is how can I make a downloadable, installable single file mobile application to use in my mobile phone.

Please, share any useful video tutorial or documentation. Thank you in advance.

Alisher Musurmonv
  • 815
  • 1
  • 9
  • 18
  • Have you tried this..?? https://facebook.github.io/react-native/docs/signed-apk-android.html – RAJESH KUMAR ARUMUGAM Sep 16 '17 at 05:00
  • Possible duplicate of [Deploy/Publish Android app made with React Native](https://stackoverflow.com/questions/32783344/deploy-publish-android-app-made-with-react-native) – RAJESH KUMAR ARUMUGAM Sep 16 '17 at 05:03
  • Maybe it is duplicated, but read [This Link](https://facebook.github.io/react-native/docs/running-on-device.html), It is official facebook tutorial. – AmerllicA Apr 15 '18 at 14:20

2 Answers2

11

ANDROID

You must generate a private key by running

$ keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

Then you have to set the generated file my-release-key.keystore under android/app in your project.

Edit the file ~/.gradle/gradle.properties as following

MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=[YOUR PASSWORD]
MYAPP_RELEASE_KEY_PASSWORD=[YOUR PASSWORD]

Now edit android/app/build.gradle as following:

android {
     ...
     defaultConfig { ... }
     signingConfigs {
         release {
             if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                 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
         }
     } }

And in your terminal run cd android && ./gradlew assembleRelease

Your APK will be generated inside this directory android/app/build/outputs/apk/ as app-release.apk

To install it in your device, run: react-native run-android --variant=release

More info in the official docs: https://facebook.github.io/react-native/docs/signed-apk-android.html

IOS

You must have an Apple Developer Account https://developer.apple.com/account/

  1. Open Xcode and sign in with your developer account

  2. Build your project

  3. From toolabar Select Product > Archive

  4. Click on Validate

  5. Click on Export

  6. Download IPA file

  7. From toolabar Click on Xcode > Open Developer Tool > Application Loader

  8. Click on Deliver App

  9. Select the downloaded IPA file

  10. Wait a few minutes and your app will be available on iTunes Connect itunesconnect.apple.com

  11. From there you can use Test Flight to distribute your app to a test team.

  12. Download Test Flight App in your device

  13. After you set up a test team, all testers will be available to download the app through Test Flight

More info here: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html

Hope it helps

soutot
  • 3,531
  • 1
  • 18
  • 22
0

You should generate a Signed APK file for android while publishing on Play store.

Click here to see full instruction of how to create signed APK file.

For iOS Click here

Pradeep Kumar
  • 586
  • 3
  • 19