![](/img/trans.png)
[英]Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.[Flutter]
[英]flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'
我只是创建一个空应用程序,然后在模拟器上运行它时,发生错误。
仅当我在 android 仿真器上运行时才会出现此错误,但 ios 工作正常。
现在我在 flutter beta 频道。
所以如果有人有任何想法,请告诉我。 谢谢
这是错误日志
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
我的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)
运行 Flutter Doctor,如果说“android licenses”的部分有感叹号和警告颜色,运行flutter doctor --android-licenses
。 只要接受一切,就会快乐。 它对我有用。
当您的依赖项中有一些需要互联网的东西时,有时会发生这种情况,例如。 火力基地。 只需打开应该可以工作的wifi!
在 app gradle 中添加buildToolsVersion
为我消除了错误。
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
...
...
}
当我尝试在实际设备上运行我的应用程序时遇到了同样的问题(尽管应用程序在模拟器上运行良好),我使用以下方法解决了它:
'flutter pub cache repair' 这应该可以解决问题
伙计们,感谢您的所有回答。
我已经弄清楚了,因为我使用了代理连接网络,所以我将其设置为 flutter ,但是当我关闭代理服务器时,发生了错误。 所以如果有人遇到同样的问题,请检查您是否在 Flutter 配置文件、vscode 和 Android Studio 中设置了代理。
我遇到了同样的问题,但后来意识到飞行模式已打开。 一旦我关闭它,问题就解决了。 我不知道是关于连接到互联网还是只是关闭了飞行模式,会更新。
当我在终端中运行flutter doctor --android-licenses
并接受所有 SDK package 许可证时,我的问题得到了解决。
当我在build.gradle 中将 compileSdkVersion从30更改为31 , minSdkVersion从16更改为19 , targetSdkVersion从30更改为31时,就会出现此问题。
我通过在 powerShell (windows) 中编写这些来解决问题:
setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"
它添加了新的环境变量。
参考: 链接
我有这个问题 无法确定任务 ':app:processDebugResources' 的依赖关系。 并通过运行flutter pub cache repair
解决
使用Android Studio
终端转到android
目录,运行 gradle wrapper build 命令并查看日志文件内容以获取详细的低级信息:
cd android
gradlew build > logs.txt 2> errors.txt
对我来说,我忘记在 /android/app/build.gradle 中更改为最新版本号
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:<version>'
}
本来应该:
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
并且它工作得很好,希望对你也很好!
这里我们需要接受 android 许可证,所以当它尝试安装 Android SDK 工具时会抛出错误。 所以要接受在 cmd 工具中运行 cmd - flutter doctor --android-licenses并接受它的所有工作。
就我而言,我使用参数 --illegal-access=permit 运行 java.exe 以进行 burp 套件运行,但在运行之后,我遇到了这个问题,我尝试了上述所有提示,但我找到了一个解决方案,通过重新安装 java较低版本并删除旧版本解决了我的问题。
在应用程序 gradle 中添加buildToolsVersion
为我消除了错误。
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
}
我遇到了同样的错误:
* 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.
首先,不要惊慌,当您使用 flutter 2 或更新版本为 android 平台构建时会遇到这个问题。 该依赖项中的某些依赖项集 compileSdkVersion 导致的此错误为 31。但是您的 SDK 管理器没有。
我遇到了同样的问题,尝试了各种方法后,我能够用两个终端命令解决它
就是这样。 有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.