繁体   English   中英

React Native:无法确定任务“:app:installDebug”的依赖关系

[英]React Native: Could not determine the dependencies of task ':app:installDebug'

我一直在尝试从 Android Studio 在我的 Android Emulator 中运行默认的 React Native App。

昨天我收到消息说找不到 Android sdk,所以我在我的 android 文件夹中创建了 local.properties 文件 (sdk.dir = C:\\Users"MyUserName"\\AppData\\Local\\Android\\Sdk)。

那行得通,但现在我遇到了另一个问题:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:installDebug'.
> java.io.IOException: Die Syntax fuer den Dateinamen, Verzeichnisnamen oder die 
Datentraegerbezeichnung ist falsch

* 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 11s

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.bat app:installDebug -PreactNativeDevServerPort=8081

我试过cd android -> gradlew clean但遇到了同样的问题。

我也试过npm install --save-dev jetifier -> npx jetify npm install --save-dev jetifier -> npx jetify npx react-native run-android但遇到了同样的问题。

我用谷歌搜索了大约 4 个小时,但找不到任何解决我问题的方法。

我对本机反应和反应很陌生,但提前感谢您的帮助。

在 local.properties 中的路径变量中使用 \\\\ 而不是 \\

所以这:

"sdk.dir = C:\\Users"MyUserName"\\AppData\\Local\\Android\\Sdk"

变成这样:

"sdk.dir = C:\\\\\\Users"MyUserName"\\\\\\AppData\\\\\\Local\\\\\\Android\\\\\\Sdk"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM