Flutter错误无法确定任务':app:compileDebugJavaWithJavac'和配置':app:debugCompileClasspath'的依赖关系

Posted

技术标签:

【中文标题】Flutter错误无法确定任务\':app:compileDebugJavaWithJavac\'和配置\':app:debugCompileClasspath\'的依赖关系【英文标题】:Flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' and config ':app:debugCompileClasspath'Flutter错误无法确定任务':app:compileDebugJavaWithJavac'和配置':app:debugCompileClasspath'的依赖关系 【发布时间】:2022-01-14 23:59:06 【问题描述】:

我不知道如何处理这个问题了。没有关于这个问题的好的文档。

我已经尝试将 gradle 升级到最新版本以及升级构建工具等。甚至有人让我运行flutter doctor --android-licenses,我做到了,但没有成功。

错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.google.zxing:core:strictly 3.3.0.
     Required by:
         project :app
      > Cannot find a version of 'com.google.zxing:core' that satisfies the version constraints: 
           Dependency path 'android:app:unspecified' --> 'com.facebook.android:facebook-android-sdk:8.2.0' --> 'com.facebook.android:facebook-common:8.2.0' --> 'com.google.zxing:core:3.3.3'
           Constraint path 'android:app:unspecified' --> 'com.google.zxing:core:strictly 3.3.0' because of the following reason: debugRuntimeClasspath uses version 3.3.0

   > Could not resolve com.google.zxing:core:3.3.3.
     Required by:
         project :app > com.facebook.android:facebook-android-sdk:8.2.0 > com.facebook.android:facebook-common:8.2.0
      > Cannot find a version of 'com.google.zxing:core' that satisfies the version constraints: 
           Dependency path 'android:app:unspecified' --> 'com.facebook.android:facebook-android-sdk:8.2.0' --> 'com.facebook.android:facebook-common:8.2.0' --> 'com.google.zxing:core:3.3.3'
           Constraint path 'android:app:unspecified' --> 'com.google.zxing:core:strictly 3.3.0' because of the following reason: debugRuntimeClasspath uses version 3.3.0

Flutter Doctor 对我的评价

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.19042.1348], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Android Studio (version 4.1.0)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    X Unable to determine bundled Java version.
[√] VS Code (version 1.63.0)
[√] Connected device (1 available)

附:我已经安装了 Flutter 和 Dart 插件。不知道为什么它仍然被列为未安装。我的电脑也重启了好几次。我也不知道为什么它无法确定捆绑 Java 版本。

【问题讨论】:

install git git-scm.com/downloads 如果未安装 git,flutter 有时会出错 安装 git 是必须的。这不是问题。 【参考方案1】:

请检查您的 Android SDK。记下您的 SDK 路径 (SDK_path),然后将其用于配置。 这是命令:

flutter config --android-studio-dir="SDK_path" 

然后再次运行颤振医生。

【讨论】:

还是不行

以上是关于Flutter错误无法确定任务':app:compileDebugJavaWithJavac'和配置':app:debugCompileClasspath'的依赖关系的主要内容,如果未能解决你的问题,请参考以下文章

Flutter Notification OneSignal - 无法确定任务':app:compileDebugJavaWithJavac'的依赖关系

Flutter Build Error:无法确定任务':app:compileDebugJavaWithJavac的依赖关系

Flutter Notification OneSignal-无法确定任务':app:compileDebugJavaWithJavac'的依赖项

颤振错误无法确定任务':app:compileDebugJavaWithJavac'的依赖关系

更新旧应用程序导致此错误 => 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系

Flutter - 构建失败并出现异常