21

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)

Leonardo Torres
  • 385
  • 1
  • 2
  • 11

4 Answers4

21

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

web_walkerX
  • 840
  • 10
  • 19
16

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

Ignatius Andrew
  • 8,012
  • 3
  • 54
  • 54
  • 7
    For newbies like me. To update `sdk platforms` and `tools`, open `Android studio`, From drop down menu `Configure` choose `SDK Manager`, then check all the need to be updated, in `SDK platforms` tab and `SDK Tools` tab, click apply down bellow and wait ... finish. Then restart VS Code, accept changes ... – Fotios Tsakiris Dec 13 '21 at 09:53
  • all the above things done but it doesnt work, Im on mac – Sami Ullah Aug 17 '22 at 09:21
  • all I could figure out was my java-sdk version, I installed java-sdk 8 and everthing works fine, no need to change anything in code. – Sami Ullah Aug 21 '22 at 13:20
0

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

Dr BDO Adams
  • 416
  • 1
  • 5
  • 13
0

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')

مصطفى
  • 555
  • 4
  • 9