简体   繁体   中英

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.

now I'm in the flutter beta channel.

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_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 . 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!

adding buildToolsVersion in app gradle removed the error for me.

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

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. so if anyone have the same problem please check if you have set proxy in your flutter config file,vscode and 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.

This problem occurred when I changed compileSdkVersion from 30 to 31 , minSdkVersion from 16 to 19 , targetSdkVersion from 30 to 31 in build.gradle.

I solved problem by writting these in 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'. and solved by running 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:

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

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. so to accept the run the cmd in cmd tool - flutter doctor --android-licenses and accept all it works.

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

adding buildToolsVersion in app gradle removed the error for me.

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. This error cause by some dependency set compileSdkVersion in that dependency is 31. But your SDK Manager don't have.

  • So you have to open SDK Manager and check to download SDK 31 (in my case). Maybe you need SDK 32 or 33 I guess

在此处输入图像描述

  • You don't need to increase your 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
  2. flutter pub get

and that was it. it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM