Home > Blockchain >  error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. w
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. w

Time:08-05

I can't launch my Android simulator. I have Android Studio installed as well as a couple of simulators. Any help appreciated!

error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.


error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.


    at makeError (/Users/mxc/Desktop/react/TikTok/node_modules/execa/index.js:174:9)
    at /Users/mxc/Desktop/react/TikTok/node_modules/execa/index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (/Users/mxc/Desktop/react/TikTok/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
    at async Command.handleAction (/Users/mxc/Desktop/react/TikTok/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.

CodePudding user response:

you have to set the environment variable in your mac system.

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
copy those texts
type nano ~/.zshrc in mac terminal
source ~/.zshrc
paste copied texts
To save it, hit Ctrl   X, type Y to save, and then enter to keep the file name as it is.
  • Related