Waseem Kurne
Waseem Kurne

Reputation: 1730

React Native: Failed to launch emulator - "The emulator quit before it finished opening"

I'm encountering an issue while trying to run my React Native project on Android using npx react-native run-android. The error message I'm receiving is:

Failed to launch emulator. Reason: The emulator quit before it finished opening. You can try starting the emulator manually from the terminal with: emulator @INFO | Storing crashdata in: /tmp/android-mypc/emu-crash-34.1.18.db, detection is enabled for process: 21525.

I've tried running the emulator manually as suggested, but I'm still facing the same problem. Can anyone help me understand what might be causing this issue and how to resolve it?

I'm using a macOS system.

Upvotes: 8

Views: 6143

Answers (5)

markus
markus

Reputation: 1

If the highest scored solution do not work for you, check how much disk space you have left on your system. In my case, there were only 3GB remaining, which was not enough to launch the emulator. After cleaning up, everything launched fine.

Upvotes: 0

Waseem Kurne
Waseem Kurne

Reputation: 1730

To run your app on an Android Emulator, follow these two steps:

  1. Launch the Emulator - emulator @name_of_device
  2. Run the app - npx react-native run-android

To get the @name_of_device open Android Studio - Device Manager, use AVD name with "_" in the spaces

For example enter image description here

Command will be - emulator @Pixel_8_Pro_API_35

Upvotes: 0

T Ultra
T Ultra

Reputation: 1

This has happened to me. I tried wiping app data (in Android Studio) and starting the emulator directly in Android Studio, to no avail.

It seems to me that is is related to a previous emulator run that was not sucessfully closed. Some sort of "lock" file is lost that prevents expo from opening a new emulator session.

My solution was to delete the node_modules folder and reinstall everything. Now it works perfectly.

Upvotes: 0

Vishal Mishra
Vishal Mishra

Reputation: 128

The Same issue happened to me.

This bug came from the command line emulator -list-avds.

My Solution:

For time being I go to Android Studio and run emulator firstly when it starts. Then I start metro and emulator command to develop...

Upvotes: 0

MHP
MHP

Reputation: 663

I also encountered this issue that appears to be related to the Android emulator v34.x.x. Specifically, the emulator -list-avds command seems to have a problem when running React Native (I was using v34.2.19). To resolve this, you only need to follow the steps provided in the following link, in order, to install the previous stable emulator manually. This should solve the problem:

https://developer.android.com/studio/emulator_archive

Upvotes: 2

Related Questions