android 无法确定任务“:app:mergeDebugAssets”的依赖项

suzh9iv8  于 2022-11-03  发布在  Android
关注(0)|答案(3)|浏览(690)

当我在我的项目上运行react-native run-android时,我得到了一个gradle的构建错误。我已经使用npm uninstall --save react-native-ftp卸载了react-native-ftp,删除了node_modules的依赖关系,清除了./gradle缓存的文件。但是错误仍然存在。
在我的环境窗口中,此项目工作正常。
发生什么事了?

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

FAILURE: Build failed with an exception.

* What went wrong:

Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve project :react-native-ftp.
     Required by:
         project :app
      > Unable to find a matching configuration of project :react-native-ftp:
          - None of the consumable configurations have attributes.

* 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 (/home/leroto/leroto-workspace/svm/frontend/node_modules/execa/index.js:174:9)
    at /home/leroto/leroto-workspace/svm/frontend/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async runOnAllDevices (/home/leroto/leroto-workspace/svm/frontend/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
    at async Command.handleAction (/home/leroto/leroto-workspace/svm/frontend/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
qv7cva1a

qv7cva1a1#

转到您的项目级android目录并运行./gradlew clean如果问题仍然存在,请删除node_modules文件夹和npm install,或者您也可以手动执行此操作:npm list,然后解决所有UNMET DEPENDENCY问题

neskvpey

neskvpey2#

第1步:检查是否已安装并更新所有“SDK平台”和“SDK工具”
第2步:在android文件夹中创建“local.properties”文件,并粘贴以下内容

sdk.dir = /Users/USERNAME/Library/Android/sdk

这应该能解决你的问题

zqdjd7g9

zqdjd7g93#

我在react-native-udp中得到了这个,进入nodemodules/react-native-udp/android/build.gradle并替换
implementation 'com.facebook.react:react-native:0.11.+'implementation 'com.facebook.react:react-native:0.70.4'合并
将模块名称更改为发生此错误的模块,并将版本号更改为当前的react版本

相关问题