react-native android 应用程序编译问题

问题描述 投票:0回答:1

第一次使用React Native,出现了一个非常严重的错误。

这是我第一次使用 React Native,所以我按照 YouTube 视频的说明进行操作(https://www.youtube.com/watch?v=8l691BQ-RGc&t=1091s),当我尝试这样做时

npx react-native run-android

我首先得到:

info A dev server is already running for this project on port 8081.
'"adb"' is not recognized as an internal or external command,
operable program or batch file.
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...

然后当它加载时,我得到:

error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > Could not determine the dependencies of null. > SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\runnl\Desktop\app\newapp\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.

帮助。我已经尝试了很多事情。这些是我尝试使用答案的其他 stackoverflow 问题。

React Native 构建错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 如何修复此错误? 如何解决无法启动模拟器的错误。原因:在 React Native 中找不到模拟器作为 `emulator -list-avds` 的输出? 未找到 SDK 位置。使用 local.properties 文件中的 sdk.dir 或 ANDROID_HOME 环境变量定义位置 * 出了什么问题:无法确定任务“:app:compileDebugJavaWithJavac”的依赖关系。 > 找不到构建工具修订版 29.0.2 未找到 SDK 位置。使用 local.properties 文件中的 sdk.dir 或 ANDROID_HOME 环境变量定义位置

react-native compiler-errors
1个回答
0
投票

最好按照原始文档中的步骤进行操作。您可以通过此链接访问实际文档。 “https://reactnative.dev/docs/environment-setup”

© www.soinside.com 2019 - 2024. All rights reserved.