0

I've made a simple react native app using the react-native init command, and I'd like to download it to my device. I'm not looking to have it on the appstore, I would just like it as an icon on my personal androidstrong text device that I can open without going through the app store. How can I accomplish this.

mdash1
  • 1,055
  • 2
  • 14
  • 29

3 Answers3

0

First, make sure that you device is in developper mode. Then run the command react-native run-android from your terminal, in your project folder.

Antoine Grandchamp
  • 6,469
  • 2
  • 29
  • 34
  • I am asking how to publish this. So that if I had a friend who was not a developer and doesn't know how run commands, they can use that app & also not have to go through the app store, perhaps just download the file and run it. Is this possible? – mdash1 Aug 22 '17 at 23:46
  • 1
    Yes it is, you need to build an [.apk](https://facebook.github.io/react-native/docs/signed-apk-android.html) file, then send it to him. – Antoine Grandchamp Aug 22 '17 at 23:50
  • You can try using expo – Ganesh Cauda Aug 23 '17 at 00:55
-1

If you are ok with using a debug build (it will be slower and may display yellow-banner warnings), a debug build is automatically generated for you when you run react-native run-android. You can find the .apk file in $(PROJECT_ROOT)/android/app/build/outputs/apk, and it will be named something like app-debug.apk.

Release builds are more complicated since they must be signed with a private RSA key to provide defense against tampering. For the sake of brevity, I would direct you to the documentation provided by Facebook for generating signed release builds.

.apk files can simply be downloaded and installed on Android devices, provided you have enabled installation from unknown sources. Usually this can be found in somewhere in settings > system > security.

SoZettaSho
  • 880
  • 10
  • 19
  • I don't have an android/app/build directory @sozettasho I used the react native init setup – mdash1 Aug 23 '17 at 02:40
  • `ls android`: `app gradle gradlew keystores build.gradle gradle.properties gradlew.bat settings.gradle` – mdash1 Aug 23 '17 at 02:40
  • In `$(PROJECT_ROOT)/android/` run `./gradlew assembleDebug` and see if that changes anything – SoZettaSho Aug 23 '17 at 02:45
  • ./gradlew assembleDebug FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > The SDK directory '/usr/local/opt/android-sdk' does not exist. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED – mdash1 Aug 23 '17 at 02:51
  • that was the error after running ./gradlew assembleDebug – mdash1 Aug 23 '17 at 02:51
  • So basically your android studio setup isn't quite complete yet. You probably just need to set your `$ANDROID_HOME` environment variable, but that's a separate question. Read [this question](https://stackoverflow.com/questions/32634352/react-native-android-build-failed-sdk-location-not-found) and facebook's documentation for generating .apk files and get yourself set up first. – SoZettaSho Aug 23 '17 at 02:56
-1

To create a standalone app you need to use expo.

https://docs.expo.io/versions/latest/guides/publishing.html

You can create a standalone app binary (an ipa or apk file) and put it in the iOS App Store and the Google Play Store.

https://docs.expo.io/versions/latest/distribution/index.html

Building Standalone Apps:

  1. Install exp: npm install -g exp
  2. Login with your Expo account: exp login
  3. Configure app.json https://docs.expo.io/versions/latest/guides/configuration.html
  4. Build: exp build:android or exp build:ios
  5. Submit it to the appropriate store.
mrded
  • 4,044
  • 2
  • 30
  • 33