我正在使用MacBook Pro。我是React Native的新手。.创建项目后,我在iOS设备上运行。正在运行。.同时在Android设备上运行,这意味着我正在收到此错误。.任何人请帮助我解决此错误。.Im将Visual Studio Code IDE用于React Native Application
预先感谢。.
错误详细信息:
[Info] local.properties file doesn't exist. Using Android SDK location from PATH.
[Info] Starting React Native Packager.
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 8 workers...
/bin/sh: adb: command not found
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...
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/manikandan/AwesomeProject/android/settings.gradle'
* What went wrong:
Could not compile settings file '/Users/manikandan/AwesomeProject/android/settings.gradle'.
startup failed:
General error during semantic analysis: Unsupported class file major version 57
所以您有两个错误要在此处作为错误日志进行修复
android
文件夹。之后请确保已在Android文件夹中创建了local.properties
文件
如果不尝试这些步骤,请手动制作local.properties
文件
右键单击项目的顶层并创建新文件'local.properties',然后添加:sdk.dir=/Users/<YourUsername>/Library/Android/sdk
清理并构建
[如果您尚未创建任何仿真器,请尝试此链接-我已发布有关如何制作Android仿真器的完整答案-
React native failed to launch emulator
编辑:
对于adb错误,您需要在Mac上安装adb驱动程序
请遵循以下步骤
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
或此命令
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
之后使用自制软件安装adb
brew cask install android-platform-tools
尝试重新运行