react-native - Linux 上 Pycharm 专业版中的 React-Native Android 和 iOS 模拟器
问题描述
我正在尝试在 Pycharm(在 Linux 上)中运行 React-native 应用程序,但我不明白如何安装 Android 和 iOS 模拟器。我试图按照这里的教程进行操作,但显然失败了。当我尝试在 Android 上启动时,react-native run-android
出现以下错误:
react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
error 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.
info Installing the app...
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.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:installDebug'.
> 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 '/media/dev/test/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 1s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
同样,当我尝试使用 iOS 时,我收到此错误:
error Could not find "Podfile.lock" at /media/dev/test/ios/Podfile.lock. Did you run "pod install" in iOS directory?
info Found Xcode project "reactNative_tests.xcodeproj"
error Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues. Run CLI with --verbose flag for more details.
Error: spawnSync xcrun ENOENT
at Object.spawnSync (internal/child_process.js:1067:20)
所以我的问题很简单:如何在 Pycharm 中安装这些模拟器?
解决方案
推荐阅读
- angular - 我们如何检查 Angular 6 中的一些复选框
- php - 需要在 Lumen 中制作发票编号生成器
- css - CSS white-space: nowrap 导致溢出
- angular - 类型“TestHotObservable”缺少“主题”类型的以下属性
':观察者、关闭、isStopped、hasError 和另外 5 个 - node.js - Express/MongoDB 中的 HTTP 请求返回散列 id 和零值而不是 JSON 对象
- android - React Native apk 已安装但未显示在菜单中
- android - 谷歌地方将重点放在搜索栏上?
- arrays - Python 引用数组中的每个 JSON 元素
- email - 从 Microsoft Outlook 2010 获取服务器设置
- powershell - 如何使 PowerShell CMake 模块显示完整的错误消息而不是修剪它?