React Native WebStorm Emulator无法启动-错误无法启动模拟器。原因:未找到仿真器作为emulator -list-avds输出。

我是WebStorm和React Native的新手,在设置环境时遇到了一个错误,该错误与我所见过的其他文章相比显得很独特。

客观

我已经在WebStorm中设置了一个默认项目,我的目标是在Windows计算机上的Android模拟器上运行该项目。

我尝试过的

我已经在WebStorm中设置了一个简单的Debug配置

React Native WebStorm Emulator无法启动-错误无法启动模拟器。原因:未找到仿真器作为emulator -list-avds输出。

我还通过Android Studio下载了一个Android模拟器,并在计算机上运行了它。

React Native WebStorm Emulator无法启动-错误无法启动模拟器。原因:未找到仿真器作为emulator -list-avds输出。

现在,当我单击调试模拟器的运行时,会出现以下错误:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'adb' is not recognized as an internal or external command,operable program or batch file.
info launching emulator...
infoerror Installing the app... 
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.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\Nicol\WebstormProjects\Dog\android\local.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.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s

Error: Command failed: gradlew.bat app:installDebug -PreactNativedevserverPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\Nicol\WebstormProjects\Dog\android\local.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.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s

    at checkExecSyncError (child_process.js:621:11)
    at execfileSync (child_process.js:639:15)
    at runOnAllDevices (C:\Users\Nicol\WebstormProjects\Dog\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.

其他信息

这是我的路径系统变量的图片:

React Native WebStorm Emulator无法启动-错误无法启动模拟器。原因:未找到仿真器作为emulator -list-avds输出。

fan7286508 回答:React Native WebStorm Emulator无法启动-错误无法启动模拟器。原因:未找到仿真器作为emulator -list-avds输出。

adb不在您的%PATH%上;确保添加adb.exe所在的文件夹(通常为$ANDROID_HOME/platform-tools,其中$ANDROID_HOME是您的Android SDK安装目录,通常为C:\Users\Your.Name\AppData\Local\Android\sdk,您可以运行where adb Windows cmd控制台中的命令找到它)到系统环境变量下的%PATH%,然后重新启动WebStorm。

您还需要根据错误消息中的建议定义%ANDROID_SDK_ROOT%环境变量

,

只需添加,Windows环境变量是区分大小写的,并且像响应本机网站所说的那样添加%LOCALAPPDATA%\Android\Sdk无效,您需要添加%localappdata%\Android\Sdk

本文链接:https://www.f2er.com/3091170.html

大家都在问