微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

出现错误:无法确定任务“:app:installDebug”的依赖关系在设备或模拟器上运行 react-native 时

如何解决出现错误:无法确定任务“:app:installDebug”的依赖关系在设备或模拟器上运行 react-native 时

我在我的 android 设备或模拟器上运行我的 react-native 应用程序时遇到问题。我总是收到这个错误,我无法修复它。

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 903 file(s) to forward-jetify. Using 16 workers...
info Starting JS server...
info Installing the app...

FAILURE: Build Failed with an exception.

* 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 'C:\Users\saadb\Desktop\ReactNative\MyApp\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 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command Failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build Failed with an exception.

* 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 'C:\Users\saadb\Desktop\ReactNative\MyApp\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 2s

    at makeError (C:\Users\saadb\Desktop\ReactNative\MyApp\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)    
    at C:\Users\saadb\Desktop\ReactNative\MyApp\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at processticksAndRejections (node:internal/process/task_queues:94:5)
    at async runOnAllDevices (C:\Users\saadb\Desktop\ReactNative\MyApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
    at async Command.handleAction (C:\Users\saadb\Desktop\ReactNative\MyApp\node_modules\@react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.

我尝试在网上清理grandlew和其他一些东西,比如删除node_modules和运行npm install。但我还是有同样的问题

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。