skip to Main Content

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:UsersarunkAppDataLocalTemp\AndroidEmulatoremu-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:UsersarunkAppDataLocalAndroidSdk/emulator/emulator @INFO    | Storing crashdata in: C:UsersarunkAppDataLocalTemp\AndroidEmulatoremu-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

2

Answers


  1. First of all. do you run it only from VSCode or you do it from Android Studio too?

    Try to run it from android studio and see if you get the same error.
    Also, try to run emulator and then run the command from you package.json.

    you can also try the following node command

    "android": "lsof -ti :8081 | xargs kill -9 && rm -rf node_modules && rm -f package-lock.json && npm i --legacy-peer-deps && cd android && ./gradlew clean && cd .. && react-native start --reset-cache"
    

    The command will kill the port 8081, removes node_modules and package-lock.json. after it will install all the dependencies again and cd to android folder and clean the gradle folder. finally runing the metro with –reset-cache flag.

    Let me know if that helps.

    Login or Signup to reply.
  2. 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 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search