颤振错误无法确定任务':app:compileDebugJavaWithJavac'的依赖关系
Posted
技术标签:
【中文标题】颤振错误无法确定任务\':app:compileDebugJavaWithJavac\'的依赖关系【英文标题】:flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'颤振错误无法确定任务':app:compileDebugJavaWithJavac'的依赖关系 【发布时间】:2020-04-15 23:13:41 【问题描述】:我只是创建一个空应用程序,然后在模拟器上运行它时,发生错误。
此错误仅在我在 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)
【问题讨论】:
我也有同样的问题,如果发现请告诉我 找到任何解决方案了吗? 需要其他答案,下面的答案对我不起作用 【参考方案1】:运行 Flutter Doctor,如果说“android licenses”的部分有感叹号和警告颜色,运行flutter doctor --android-licenses
。只要接受一切,就会快乐。它对我有用。
【讨论】:
为我工作,flutter医生是救世主【参考方案2】:这有时会发生在您的依赖项中有一些需要互联网的东西时,例如。火力基地。只需打开应该可以工作的 wifi!
【讨论】:
是的,你是对的,这解决了我的问题,谢谢老兄【参考方案3】:在 app gradle 中添加 buildToolsVersion
为我消除了错误。
android
compileSdkVersion 29
buildToolsVersion "29.0.0"
...
...
【讨论】:
【参考方案4】:当我尝试在实际设备上运行我的应用程序时遇到了同样的问题(尽管应用程序在模拟器上运行良好)并且我使用以下方法解决了它:
'flutter pub缓存修复' 这应该可以解决问题
【讨论】:
这只是重新下载包...它不能解决问题 这个错误有时会在包裹中缺少物品时发生……所以重新下载包裹有时会起作用……因为我的就是这样 您的 pub 缓存中的包可能会更改或损坏。例如,某些编辑器可以很容易地在 pub 缓存中找到包的实现文件,而您可能会不小心编辑其中一个文件。 pub cache repair 命令对系统缓存中的所有托管包和 git 包执行干净的重新安装。【参考方案5】:伙计们,感谢您的所有回答。
我已经弄明白了,因为我使用了代理连接网络,所以我将它设置为 flutter ,但是当我关闭代理服务器时,发生了错误。 所以如果有人有同样的问题,请检查你是否在你的flutter配置文件,vscode和Android Studio中设置了代理。
【讨论】:
【参考方案6】:我遇到了同样的问题,但后来意识到飞行模式已打开。一旦我关闭它,问题就解决了。不知道是连接网络还是关闭飞行模式,会更新的。
【讨论】:
【参考方案7】:我通过在 powerShell (windows) 中编写这些来解决问题:
setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"
它添加了新的环境变量。
参考:link
【讨论】:
【参考方案8】:我遇到过这个问题
无法确定任务 ':app:processDebugResources' 的依赖关系。
并通过运行flutter pub cache repair
解决了
【讨论】:
【参考方案9】:使用Android Studio
终端转到android
目录,运行 gradle wrapper build 命令并查看日志文件内容以获取详细的低级信息:
cd android
gradlew build > logs.txt 2> errors.txt
【讨论】:
【参考方案10】:对我来说,我忘记在 /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'
【讨论】:
【参考方案11】:我遇到过这个问题,我确实在项目根目录的终端中运行了flutter clean
,执行后,build gradle
和get dependencies
花了一些时间
在那之后,我重新构建了我的项目,它工作得非常好,希望对你也好!
【讨论】:
【参考方案12】:这里我们需要接受 android 许可证,所以当它尝试安装 Android SDK 工具时会抛出错误。 所以接受在 cmd 工具中运行 cmd - flutter doctor --android-licenses 并接受它的所有工作。
【讨论】:
【参考方案13】:在我的例子中,我使用参数 --illegal-access=permit
运行 java.exe 来运行 burp 套件,但在运行之后我遇到了这个问题。
我已经尝试了上述所有提示,但我找到了一个解决方案,通过重新安装较低版本的 java 并删除旧版本解决了我的问题。
【讨论】:
【参考方案14】:当我在终端中运行 flutter doctor --android-licenses
并接受所有 SDK 包许可证时,我的问题得到了解决。
这个问题是我改的时候出现的 compileSdkVersion 从 30 到 31, minSdkVersion 从 16 到 19, targetSdkVersion 在 build.gradle 中从 30 到 31。
【讨论】:
【参考方案15】:在 app gradle 中添加 buildToolsVersion
为我消除了错误。
android
compileSdkVersion 30
buildToolsVersion "30.0.0"
【讨论】:
以上是关于颤振错误无法确定任务':app:compileDebugJavaWithJavac'的依赖关系的主要内容,如果未能解决你的问题,请参考以下文章
颤振应用程序发布显示错误任务':app:validateSigningRelease'执行失败
颤振应用程序发布显示错误任务':app:validateSigningRelease'执行失败
Flutter错误无法确定任务':app:compileDebugJavaWithJavac'和配置':app:debugCompileClasspath'的依赖关系
更新旧应用程序导致此错误 => 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系
任务“:app:processDebugResources”的颤振执行失败。 AAPT:错误:找不到资源字符串/app_name