user16070299
user16070299

Reputation:

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. having issue's in Cordova

I always get these errors while building my Cordova project and i tried updating everything in SDK manager and acceppting all licenses but i still get these error's. how can I fix this?

ANDROID_SDK_ROOT=C:\Users\Amir\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\Amir\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\Amir\AppData\Local\Android\Sdk
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Observed package id 'emulator' in inconsistent location 'C:\Users\Amir\AppData\Local\Android\Sdk\emulator-2' (Expected 'C:\Users\Amir\AppData\Local\Android\Sdk\emulator')
Build-tool 31.0.0 is missing DX at C:\Users\Amir\AppData\Local\Android\Sdk\build-tools\31.0.0\dx.bat
Observed package id 'emulator' in inconsistent location 'C:\Users\Amir\AppData\Local\Android\Sdk\emulator-2' (Expected 'C:\Users\Amir\AppData\Local\Android\Sdk\emulator')
File C:\Users\Amir\.android\repositories.cfg could not be loaded.
Observed package id 'emulator' in inconsistent location 'C:\Users\Amir\AppData\Local\Android\Sdk\emulator-2' (Expected 'C:\Users\Amir\AppData\Local\Android\Sdk\emulator')
Build-tool 31.0.0 is missing DX at C:\Users\Amir\AppData\Local\Android\Sdk\build-tools\31.0.0\dx.bat

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

* 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 16s
Command failed with exit code 1: L:\Amir-Softwares\Web dev\Vue android\amir-weather\src-cordova\platforms\android\gradlew cdvBuildDebug -b L:\Amir-Softwares\Web dev\Vue android\amir-weather\src-cordova\platforms\android\build.gradle

 App • Command "cordova" failed with exit code: 1
 App • Updated Cordova config.xml

 App • ⚠️   FAIL  Cordova CLI has failed```

Upvotes: 8

Views: 33847

Answers (2)

user14783372
user14783372

Reputation:

First, delete every related folders and files. Then, reinstall everything

in the root folder disk:

enter image description here

inside the Users\Usuario\appData\Roaming folder

enter image description here

inside the Users\Usuario\.android folder

enter image description here

inside the Users\Usuario\appData\Android folder , delete all its content

enter image description here

inside the program files, delete the folder before uninstalling android studio (Using Control Panel or Config->Apps)

enter image description here

Delete the "path" environment variable

enter image description here

enter image description here

Finally, reinstall android studio.

This error made me lose 4 hours, and the best thing I did was completely delete everything. Cause of this error is because, you have two build-tools registered.

You can use. $> ns setup. to set up a new environment

ns setup

Upvotes: 2

MikeSuspend
MikeSuspend

Reputation: 307

as the outpus sais, the Build Tools revision 31.0.0 is apparently corrupted. All you need to do is:

  1. Open Android Studio
  2. Go to Tools, SDK Manager
  3. On SDK Tools, click on Show Package details
  4. On Android SDK Build-Tools 31, uncheck the version 31.0.0 and check the 30.0.3
  5. Click on Apply, and it'll install the version.

It should look something like this: Android Studio Screenshot

Upvotes: 15

Related Questions