Leonardo Torres
Leonardo Torres

Reputation: 435

Could not determine the dependencies of task ':app:mergeDebugAssets'

When I run react-native run-android on my project,I get an build error of gradle. I already uninstalled react-native-ftp with npm uninstall --save react-native-ftp, removed that dependency of node_modules, clear ./gradle cached files. But the error continuous..

In my environment windows this project works normally.

What's happing?

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)

Upvotes: 26

Views: 121421

Answers (5)

مصطفى
مصطفى

Reputation: 985

first

  1. click on android folder
  2. click on settings.gradle file
  3. remove this
include ':react-native-ftp'

project(':react-native-ftp').projectDir = new
   File(rootProject.projectDir,
   '../node_modules/react-native-ftp/android')

second

  1. click on android folder
  2. click on app folder
  3. click on build.gradle file and remove
implementation project(':react-native-ftp')

Upvotes: 0

Klaudio Luku
Klaudio Luku

Reputation: 7

I have struggled a lot with this issue too. What I understood is that this kind of errors are mostly related to compatibility issues. This is what worked for me:

Step 1

As other people suggested, to be sure that there are no conflicts in your modules you should remove the entire node-modules folder.
Before running npm install to get back all the libraries you should first check the compatibility between react-native, gradle and jdk by finding what is the right version to use. For me since I was using expo I started by fixing it's version and then select all the other ones (I also checked all other modules in the app.json).

It's important to ensure that gradle is using the right version of the jdk: in particular for most of the versions jdk-17 is the way to go. I'm enfasing a lot on this because this was the main issue since I first tried to use jdk-23 and then realized that was not the correct one.

You should check the enviromental variable JAVA_HOME if has the correct path to the correct jdk version. Also ensure that the new enviromental variables are loaded. You can check it through terminal by running

Get-ChildItem -Path Env:

(If you are using VSCode just close and open again it, once you have changed the path, to reload all the enviromental variables)

Step 2

Now you can run

npm install

and if you are using expo, run also

npx expo install

You can now try again to build the application (for me npx expo run:android) crossing your fingers that no more errors appear. Hope this was useful to anyone facing my same problem.

Upvotes: 0

Dr BDO Adams
Dr BDO Adams

Reputation: 405

I got this at react-native-udp go into nodemodules/react-native-udp/android/build.gradle and replace
implementation 'com.facebook.react:react-native:0.11.+' with implementation 'com.facebook.react:react-native:0.70.4'

changing the module name to the module where this occurred and the version number to your current react version

Upvotes: 0

Ignatius Andrew
Ignatius Andrew

Reputation: 8258

Step1: Check whether all your "SDK Platforms" and "SDK Tools" is installed and Updated"

Step2: Create "local.properties" file in android folder and paste the following

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

THIS SHOULD SOLVE YOUR PROBLEMS

Upvotes: 19

web_walkerX
web_walkerX

Reputation: 880

Go to your project level android directory and run ./gradlew clean If the problem persists, delete node_modules folder and npm install or you can do this manually: npm list and then resolve all UNMET DEPENDENCY issues

Upvotes: 24

Related Questions