简体   繁体   中英

When i start npx react-native run-android in my react-native in terminal command this issue is coming

info Starting JS server...

info Launching emulator... error Failed to launch emulator. Reason: Could not start emulator within 30 seconds.. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app...

Connecting to Daemon

5 actionable tasks: 5 up-to-date

FAILURE: Build failed with an exception.

  • Where: Build file 'C:<user_name>\android\app\build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':app'.

Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. Your current JDK is located in C:\Program Files\Java\jdk1.8.0_202\jre You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing org.gradle.java.home in gradle.properties .

  • 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.

BUILD FAILED in 14s

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.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • Where: Build file 'C:<user_name>\android\app\build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':app'.

Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. Your current JDK is located in C:\Program Files\Java\jdk1.8.0_202\jre You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing org.gradle.java.home in gradle.properties .

  • 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.

BUILD FAILED in 14s

at makeError (C:\<user_name>\node_modules\execa\index.js:174:9)
at C:\<user_name>\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\<user_name>\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\U<user_name>\node_modules\@react-native-community\cli\build\index.js:142:9)

info Run CLI with --verbose flag for more details.


Please Solve this error

It clearly says that u didn't connected a device or emulator.

Either you need to connect a physical device (Mobile) via usb cable

OR

You need to run an emulator (you can create a virtual device with the help of android studio)

(If you have connected a physical device, check whether usb debubing is ON)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM