简体   繁体   English

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

[英]flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

I just cerate a empty application,then when I run it on emulator ,error happend.我只是创建一个空应用程序,然后在模拟器上运行它时,发生错误。

this error only arise when I run on android emulator, but ios works fine.仅当我在 android 仿真器上运行时才会出现此错误,但 ios 工作正常。

now I'm in the flutter beta channel.现在我在 flutter beta 频道。

so If anyone has any ideas, please let me know.所以如果有人有任何想法,请告诉我。 thanks谢谢

here is the error log这是错误日志

Launching lib/main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...

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 io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
     Required by:
         project :app
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/flutter_embedding_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
   > Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
   > Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset
      > Could not resolve io.flutter:x86_64_debug:1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695/x86_64_debug-1.0.0-2994f7e1e682039464cb25e31a78b86a3c59b695.pom'.
               > Connection reset

* 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 4s
Finished with error: Gradle task assembleDebug failed with exit code 1

and my flutter doctor show as below我的flutter doctor显示如下

➜  flutter_demo flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Mac OS X 10.15.2 19C57, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (1 available)

Run Flutter Doctor, if the section who says "android licenses" have a exclamation point and warning color, run flutter doctor --android-licenses .运行 Flutter Doctor,如果说“android licenses”的部分有感叹号和警告颜色,运行flutter doctor --android-licenses Just accept all and will be happy.只要接受一切,就会快乐。 It work to me.它对我有用。

This sometimes happen when you have something in your dependencies that require internet eg.当您的依赖项中有一些需要互联网的东西时,有时会发生这种情况,例如。 Firebase.火力基地。 Just turn on your wifi that should work!只需打开应该可以工作的wifi!

adding buildToolsVersion in app gradle removed the error for me.在 app gradle 中添加buildToolsVersion为我消除了错误。

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
...
...
}

I encountered same issue when i tried running my app on an actual device(App works perfectly on Emulator though) and i resolved it using:当我尝试在实际设备上运行我的应用程序时遇到了同样的问题(尽管应用程序在模拟器上运行良好),我使用以下方法解决了它:

' flutter pub cache repair ' This should fix the problem 'flutter pub cache repair' 这应该可以解决问题

guys, thanks for all your answers.伙计们,感谢您的所有回答。

I have figured it out , becaues I had used a proxy to connect network, so I set it in flutter , but when I close my proxy server, error happend.我已经弄清楚了,因为我使用了代理连接网络,所以我将其设置为 flutter ,但是当我关闭代理服务器时,发生了错误。 so if anyone have the same problem please check if you have set proxy in your flutter config file,vscode and Android Studio.所以如果有人遇到同样的问题,请检查您是否在 Flutter 配置文件、vscode 和 Android Studio 中设置了代理。

I faced the same issue, but later realised the Airplane mode was turned on.我遇到了同样的问题,但后来意识到飞行模式已打开。 Once I turned it off, the issue was resolved.一旦我关闭它,问题就解决了。 I don't know if it's about connecting to the internet or just turning off your airplane mode, will update.我不知道是关于连接到互联网还是只是关闭了飞行模式,会更新。

My problem was solved when I run flutter doctor --android-licenses in the terminal and accept all SDK package licenses.当我在终端中运行flutter doctor --android-licenses并接受所有 SDK package 许可证时,我的问题得到了解决。

This problem occurred when I changed compileSdkVersion from 30 to 31 , minSdkVersion from 16 to 19 , targetSdkVersion from 30 to 31 in build.gradle.当我在build.gradle 中将 compileSdkVersion30更改为31minSdkVersion16更改为19targetSdkVersion30更改为31时,就会出现此问题。

I solved problem by writting these in powerShell (windows) :我通过在 powerShell (windows) 中编写这些来解决问题:

setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"

It adds new environment variables.它添加了新的环境变量。

ref: link参考: 链接

I hade this problem Could not determine the dependencies of task ':app:processDebugResources'.我有这个问题 无法确定任务 ':app:processDebugResources' 的依赖关系。 and solved by running flutter pub cache repair并通过运行flutter pub cache repair解决

With the Android Studio terminal go to android directory, run the gradle wrapper build command and see the log files content for detailed low level information:使用Android Studio终端转到android目录,运行 gradle wrapper build 命令并查看日志文件内容以获取详细的低级信息:

cd android
gradlew build > logs.txt 2> errors.txt

For me, I had forgotten to change to the latest version number in /android/app/build.gradle对我来说,我忘记在 /android/app/build.gradle 中更改为最新版本号

dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
     implementation 'com.google.android.material:material:<version>'
}

Should have been:本来应该:

dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
     implementation 'com.google.android.material:material:1.3.0'
}

我遇到过这个问题,我确实在项目根目录的终端中运行了flutter clean ,执行后,我花了一些时间来build gradle并在我重新build gradle我的项目之后get dependencies并且它工作得很好,希望对你也很好!

Here we need to accept the android license so , when it tried to install Android SDK tools it throws error.这里我们需要接受 android 许可证,所以当它尝试安装 Android SDK 工具时会抛出错误。 so to accept the run the cmd in cmd tool - flutter doctor --android-licenses and accept all it works.所以要接受在 cmd 工具中运行 cmd - flutter doctor --android-licenses并接受它的所有工作。

就我而言,我使用参数 --illegal-access=permit 运行 java.exe 以进行 burp 套件运行,但在运行之后,我遇到了这个问题,我尝试了上述所有提示,但我找到了一个解决方案,通过重新安装 java较低版本并删除旧版本解决了我的问题。

adding buildToolsVersion in app gradle removed the error for me.在应用程序 gradle 中添加buildToolsVersion为我消除了错误。

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.0"
}

I was getting the same error:我遇到了同样的错误:

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-30).
        Dependency: androidx.window:window-java:1.0.0-beta04.
        AAR metadata file: /Users/mac/.gradle/caches/transforms-2/files-2.1/303b1d5c92626d13b7b34f99ebc8e3cc/jetified-window-java-1.0.0-beta04/META-INF/com/android/build/gradle/aar-metadata.properties.
 > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-30).
        Dependency: androidx.window:window:1.0.0-beta04.
        AAR metadata file: /Users/mac/.gradle/caches/transforms-2/files-2.1/89c5e3b5bbdbf14dfb30b0ad70ac7d82/jetified-window-1.0.0-beta04/META-INF/com/android/build/gradle/aar-metadata.properties.


First, don't panic, you face this problem when use flutter 2 or newer to build for android platform.首先,不要惊慌,当您使用 flutter 2 或更新版本为 android 平台构建时会遇到这个问题。 This error cause by some dependency set compileSdkVersion in that dependency is 31. But your SDK Manager don't have.该依赖项中的某些依赖项集 compileSdkVersion 导致的此错误为 31。但是您的 SDK 管理器没有。

  • So you have to open SDK Manager and check to download SDK 31 (in my case).因此,您必须打开 SDK 管理器并检查以下载 SDK 31(在我的情况下)。 Maybe you need SDK 32 or 33 I guess也许你需要 SDK 32 或 33 我猜

在此处输入图像描述

  • You don't need to increase your compileSdkVersion.你不需要增加你的 compileSdkVersion。
  • Rebuild it重建它

I encountered the same problem, after trying various method, I was able to resolve it with two terminal commands我遇到了同样的问题,尝试了各种方法后,我能够用两个终端命令解决它

  1. run flutter clean运行 flutter 清洁
  2. flutter pub get flutter 酒吧得到

and that was it.就是这样。 it worked.有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法确定任务 &#39;:app:compileDebugJavaWithJavac&#39; 的依赖关系。[Flutter] - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.[Flutter] 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系 - Flutter - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' - Flutter 无法确定任务 ':app:compileDebugJavaWithJavac' Flutter 的依赖关系 - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' Flutter Flutter 构建错误:无法确定任务':app:compileDebugJavaWithJavac的依赖关系 - Flutter Build Error:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac 错误:无法确定任务&#39;:app:compileDebugJavaWithJavac&#39;的依赖关系 - Error:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' 错误=&gt;无法确定任务&#39;:app:compileDebugJavaWithJavac&#39;的依赖关系 - Error=> Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' flutter run 无法确定任务&#39;:app:compileDebugJavaWithJavac&#39;的依赖关系 - flutter run Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' Flutter 通知 OneSignal - 无法确定任务 &#39;:app:compileDebugJavaWithJavac&#39; 的依赖关系 - Flutter Notification OneSignal - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' 无法确定任务“:app:compileDebugJavaWithJavac”的依赖关系。 - 颤振问题 - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. - Flutter Issue flutter 错误无法确定任务':app:compileDebugJavaWithJavac'和配置':app:debugCompileClasspath'的依赖关系 - flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' and config ':app:debugCompileClasspath'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM