簡體   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