androidreact-nativeandroid-emulatormetro-bundler

android emulator always giving error emu-crash-xx-xx.db and quit before it finished opening


I have completed new setup in windows for react native : whenever I am trying to start the emulator from command I am getting this issue , but I can open emulator inside android studio without any problem

> react-native run-android

* daemon not running; starting now at tcp:5037
* daemon started successfully
info Launching emulator...
error Failed to launch emulator. Reason: The emulator (INFO    | Storing crashdata in: C:\Users\arunk\AppData\Local\Temp\\AndroidEmulator\emu-crash-34.1.18.db, detection is enabled for process: 13500) quit before it finished opening. You can try starting the emulator manually from the terminal with: C:\Users\arunk\AppData\Local\Android\Sdk/emulator/emulator @INFO    | Storing crashdata in: C:\Users\arunk\AppData\Local\Temp\\AndroidEmulator\emu-crash-34.1.18.db, detection is enabled for process: 13500.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
BUILD FAILED in 19s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: No online devices found. * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 19s.

raised issue on github too text

I am trying to run android emulator usign

npm run android 

or

npx react-native run-android

expected : after metro start android emulator should start automatically but it is failing everytime and giving this emu-crash.db logs issue

trying to delete that log file too tried to run different version of react native too


Solution

  • I have the same problem.

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

    Now this command line add a new log at the first line :

    INFO    | Storing crashdata in: /tmp/android-xxx/emu-crash-34.1.18.db, detection is enabled for process: 20206
    .Pixel_2_API_31
    2.7_QVGA_API_31
    3.2_QVGA_ADP2_API_31
    3.7_WVGA_Nexus_One_API_31
    6.7_Horizontal_Fold-in_API_31
    Pixel_2_API_29
    Pixel_2_API_33
    Pixel_XL_API_31
    

    The problem is that react-native take always the first emulator in this list as default emulator to launch. But now it try to open INFO | Storing crashdata in: /tmp/android-matthias/emu-crash-34.1.18.db, detection is enabled for process: 20206 that is not a emulator name, but just a log info.

    To launch the emulator, until a fix, you can still use the command line

    emulator @name_of_device
    

    then use the common command :

    npm run android