Javascript React Native,未能启动emulator。原因:未找到作为输出的仿真器

Javascript React Native,未能启动emulator。原因:未找到作为输出的仿真器,javascript,android,react-native,Javascript,Android,React Native,我试图使用命令react native run android在emulator中运行我的react native应用程序,但它抛出了那个错误 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

我试图使用命令
react native run android
在emulator中运行我的react native应用程序,但它抛出了那个错误

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

BUILD SUCCESSFUL in 44s
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync /Opt/Android/platform-tools/adb ENOENT
info Starting the app...
The system cannot find the path specified.
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: Command failed: /Opt/Android/platform-tools/adb shell am start -n com.reactproject/com.reactproject.MainActivity
    at makeError (C:\Users\Danger World\ReactProject\node_modules\execa\index.js:174:9)

我已经设置了我的android studio和sdk管理器,avd管理器,就像它在文档中显示一样,我也已经设置了路径,但它仍然显示错误,有人知道为什么吗?有人能帮忙吗?

像这样设置AVD管理器路径和JDK路径,还必须添加Android主路径

在我的情况下,我必须在您尝试运行npx react native run android的同一终端上重新运行该命令

第一步。首先粘贴源命令

source~/.bash_配置文件或source~/.bashrc

第二步。运行下一个命令

npx反应本机运行android


您可以使用以下命令修复它:

react-native doctor
此命令显示所有需要修复的问题

按f键修复问题,不要忘记重新启动windows

然后在运行项目之前打开模拟器。 一旦模拟器打开, 运行命令: react本地运行的android

固定后:


如果可以的话,别忘了给我一个升级票。

谢谢,但是我每次都要在第二步之前写下这个吗?有没有什么全球性的方法来解决这个问题谢谢分享。这个命令很好用,很简单。爱死它了!