运行 Android 在 React Native 上构建时出错
Error While Running Android Build On React Native
我已经安装了所有必要的 SDK 和 Platform Tools。我打开了模拟器,运行,在 PATH 中添加了 adb。这个错误仍然没有让我通过。
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 4 workers...
info JS server already running.
info Launching emulator...
/bin/sh: adb: command not found
info Installing the app...
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.
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
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
FAILURE: Build failed with an exception.flag for more details.
* 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 '/Users/manndave/IdeaProjects/MyFirstReactNative/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 3s
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081```
请运行在项目文件夹内的终端
export ANDROID_HOME=/Users/{yourusername}/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
然后 npm 运行 android
就我而言,我有来自另一个项目的 运行 Metro Bundler。关闭它解决了我的问题。
我已经安装了所有必要的 SDK 和 Platform Tools。我打开了模拟器,运行,在 PATH 中添加了 adb。这个错误仍然没有让我通过。
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 4 workers...
info JS server already running.
info Launching emulator...
/bin/sh: adb: command not found
info Installing the app...
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.
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
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
FAILURE: Build failed with an exception.flag for more details.
* 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 '/Users/manndave/IdeaProjects/MyFirstReactNative/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 3s
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081```
请运行在项目文件夹内的终端
export ANDROID_HOME=/Users/{yourusername}/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
然后 npm 运行 android
就我而言,我有来自另一个项目的 运行 Metro Bundler。关闭它解决了我的问题。