简体   繁体   中英

React Native, why react-native run-android not working?

I'm trying to run react native run-android after I update my project file, but whenever I run react-native it throws an error. When I created that project and that command it worked fine but when I edit and add some files like apps/redux, apps/components, screens etc it stopped working. Can anyone tell me why it's not working?

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

> Task :app:compileDebugJavaWithJavac

> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.

> Task :app:installDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 6 executed, 21 up-to-date
Note: C:\Users\Danger World\ReactProject\android\app\src\debug\java\com\reactproject\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

* 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 1m 11s

error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: C:\Users\Danger World\ReactProject\android\app\src\debug\java\com\reactproject\ReactNativeFlipper.java uses or overrides a deprecated API. 

you either need to create a virtual device or connect a physical device with USB debuging enabled ( https://developer.android.com/studio/debug/dev-options ).

To create a virtual device, open android studio and select AVD manager from Configure menu and create a new virtual device downloading required packages.

In case you are using a virtual device with Android studio then try to manually run the emulator BEFORE react-native run-android. (open android studio > Tools > AVD Manager > Create Virtual Device)

https://developer.android.com/studio/run/managing-avds#createavd

Or repeat the official installation guide:

https://reactnative.dev/docs/environment-setup

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