javascript - React Native,为什么 react-native run-android 不起作用?
问题描述
更新项目文件后,我尝试运行 react native run-android ,但是每当我运行react-native
它时都会引发错误。当我创建该项目和该命令时,它运行良好,但是当我编辑和添加一些文件(如应用程序/redux、应用程序/组件、屏幕等)时,它停止工作。谁能告诉我为什么它不起作用?
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.
解决方案
您需要创建虚拟设备或连接启用 USB 调试的物理设备 ( https://developer.android.com/studio/debug/dev-options )。
要创建一个虚拟设备,打开 android studio 并从Configure
菜单中选择 AVD manager 并创建一个新的虚拟设备下载所需的包。
推荐阅读
- python - Python 3 中基于文本的 RPG 错误 - 关键字不能用作表达式
- excel - 如何在 VBA 中引用结构化表格而不引用其工作表
- r - 在特定条件下随机增加一行的值(二进制)
- jenkins - 如何安排 Jenkins 作业在每个月的最后一天运行
- barcode - Code128 条码规范中是否需要校验和?
- sql - 表中不存在键列。SQL
- f# - F# 具有冲突/排序/互斥锁的异步操作
- mysql - 由于 galera 配置,MySQL 无法启动
- sql - 使用 Visual Basic Forms 和 SQL 在 Access 中编辑记录
- javascript - LightGallery 同一页面上的多个画廊