无法确定任务“:app:compileDebugJavaWithJavac”的依赖关系。在科尔多瓦有问题

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

我在构建 Cordova 项目时总是遇到这些错误,我尝试更新 SDK 管理器中的所有内容并接受所有许可,但我仍然遇到这些错误。我该如何解决这个问题?

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.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.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```

正如输出所说,Build Tools 修订版 31.0.0 显然已损坏。您需要做的就是:

  1. 打开Android工作室
  2. 转到工具、SDK 管理器
  3. 在 SDK 工具上,单击显示包详细信息
  4. 在 Android SDK Build-Tools 31 上,取消选中版本 31.0.0 并选中 30.0.3
  5. 点击应用,它会安装版本。

它应该看起来像这样:

首先删除所有文件夹和文件。 重新安装一切

在根文件夹磁盘中:

在文件夹 Users\Usuario\appData\Roaming

在文件夹 Users\Usuario\.android

在文件夹 Users\Usuario\appData\Android 中,删除所有文件夹

卸载软件前在program files dele forder androidstudio在控制面板或Config->Apps

删除路径或环境系统

并重新安装 android 工作室。 这个错误让我损失了 4 个小时,而我做的最好的事情就是完全删除所有内容。这个错误是因为你注册了两个build-tools,可以使用。 $> ns 设置。设置新环境

ns setup