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

8 java android gradle cordova

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

\n
ANDROID_SDK_ROOT=C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk (recommended setting)\nANDROID_HOME=C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk (DEPRECATED)\nUsing Android SDK: C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\nSubproject Path: CordovaLib\nSubproject Path: app\nStarting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details\nObserved package id 'emulator' in inconsistent location 'C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\emulator-2' (Expected 'C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\emulator')\nBuild-tool 31.0.0 is missing DX at C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\build-tools\\31.0.0\\dx.bat\nObserved package id 'emulator' in inconsistent location 'C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\emulator-2' (Expected 'C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\emulator')\nFile C:\\Users\\Amir\\.android\\repositories.cfg could not be loaded.\nObserved package id 'emulator' in inconsistent location 'C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\emulator-2' (Expected 'C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\emulator')\nBuild-tool 31.0.0 is missing DX at C:\\Users\\Amir\\AppData\\Local\\Android\\Sdk\\build-tools\\31.0.0\\dx.bat\n\nFAILURE: Build failed with an exception.\n\n* What went wrong:\nCould not determine the dependencies of task ':app:compileDebugJavaWithJavac'.\n> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.\n\n* Try:\nRun 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.\n\n* Get more help at https://help.gradle.org\n\nBUILD FAILED in 16s\nCommand 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\n\n App \xe2\x80\xa2 Command "cordova" failed with exit code: 1\n App \xe2\x80\xa2 Updated Cordova config.xml\n\n App \xe2\x80\xa2 \xe2\x9a\xa0\xef\xb8\x8f   FAIL  Cordova CLI has failed```\n
Run Code Online (Sandbox Code Playgroud)\n

小智 15

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

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

它应该看起来像这样: Android Studio 截图