1

I have a react-native app that I have just ejected from expo to a bare react-native app.

I can run yarn react-native run-android without any errors and even opens my android emulator however, I can't see my app available within the emulator.

Should this open automatically or should I see it available in the app draw?

How can I start my app within the emulator?

enter image description here

note: the Who Am I app is not it. It's my built version via expo before I ejected.

Stretch0
  • 8,362
  • 13
  • 71
  • 133

1 Answers1

1

The command should be react-native run-android not yarn react-native run-android unless you defined the script react-native run-android as itself in your package.json.

Then the app should start by itself in the emulator, but you have to run react-native start to use it.

react-native run-android installs the app on the emulator so you should be able to find the launch icon of your app inside the emulator

Using react-native run-android without exactly one device (one emulator or one real device) leads to an error (Failed to install the app. Make sure you have an Android emulator running or a device connected. in case none is connected) thus if you don't have a real device connected your emulator is detected.

Simon
  • 6,025
  • 7
  • 46
  • 98
  • I'm using yarn so I need to prefix with `yarn` https://stackoverflow.com/a/60303085/3528590 – Stretch0 Apr 10 '20 at 12:14
  • I'm using yarn too ;) – Simon Apr 10 '20 at 12:15
  • I have just tried with `npx react-native run-android` and get the same thing – Stretch0 Apr 10 '20 at 12:17
  • Do you have react-native installed globally via NPM or via Yarn? – Stretch0 Apr 10 '20 at 12:18
  • yes I have but I run react-native with `yarn android` since I have in the script part of my `package.json` this line: `"android": "react-native run-android"` – Simon Apr 10 '20 at 12:20
  • yeah same with me. `yarn android` runs `react-native run-android` which is the same as `yarn react-native run-android` – Stretch0 Apr 10 '20 at 12:21
  • When you run yarn android, nothing happens on the emulator and you don't get any error message in the terminal? And no real device is connected to your computer? – Simon Apr 10 '20 at 12:26
  • I wasn't running `react-native start` as well. So now when I run `react-native run-android` I get `Downloading https://services.gradle.org/distributions/gradle-4.10.1-all.zip Exception in thread "main" javax.net.ssl.SSLException: Received fatal alert: protocol_version` – Stretch0 Apr 10 '20 at 12:28
  • Normally this error is not related to react-native start but yes it's not very clear at first that you install the app with run-android and actually run it with start. The error is now something else, you probably just don't have Gradle installed – Simon Apr 10 '20 at 12:30