【问题标题】:Flutter Execution failed for task ':app:processDebugResources'. Could not resolve all dependencies for configuration ':app:debugCompileClasspath'任务“:app:processDebugResources”的颤振执行失败。无法解析配置“:app:debugCompileClasspath”的所有依赖项
【发布时间】:2022-01-16 11:52:45
【问题描述】:

Flutter 项目今天突然停止构建。

这是完整的错误:


* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
   > Problems reading data from Binary store in /private/var/folders/_5/q7ql37gj5k7f37d865zhzl8c0000gn/T/gradle18017070233811730283.bin offset 35036 exists? true

* 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 28s
Running Gradle task 'assembleDebug'...                             29.7s
Exception: Gradle task assembleDebug failed with exit code 1

我试过了:

flutter clean,删除了pubspec.lockflutter pub cache repair 以清除缓存并重新安装软件包,但什么也没有。

flutter downgrade,同样的错误。

重新安装 Flutter,同样的事情。

项目的新鲜git clone,什么都没有。

有什么提示吗?

这是我的flutter doctor -v

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale
    en-GB)
    • Flutter version 2.8.1 at /Users/gracielacarrillo/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (4 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version
    31.0.0)
    • Android SDK at /Users/gracielacarrillo/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (2 available)
    • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64  • Android 11
      (API 30) (emulator)
    • Chrome (web)              • chrome        • web-javascript • Google
      Chrome 97.0.4692.71

• No issues found!

【问题讨论】:

  • 你跑了吗:flutter pub get?如果是,在Android Studio中打开项目的android模块并同步Gradle。
  • @VarunKumar 我做到了。刚刚去同步 Gradle 并得到了这个:Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/maven-metadata.xml'. Received status code 502 from server: Bad Gateway Disable Gradle 'offline mode' and sync project。我已禁用离线模式,但仍然出现相同的错误。我可以看到 Bintray 已关闭:jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/… 任何解决方法?谢谢!
  • 确保离线模式处于非活动状态。如果图标突出显示,则它处于活动状态。如果处于非活动状态,则升级项目结构中的 Gradle 版本。
  • @VarunKumar 谢谢,同样的错误。它处于离线状态,仍在尝试给我:Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/maven-metadata.xml'. Received status code 502 from server: Bad Gateway Disable Gradle 'offline mode' and sync project。我已禁用离线并重新启动了 android studio。没有什么。更新至 7.3.3 Gradle 版本,Android Gradle Plugin 版本为 4.1

标签: android flutter dart


【解决方案1】:

也许您因为 jcenter 而遇到错误。按照链接切换到 mavenCenteral。

Switch to Maven Central

【讨论】:

  • 我切换到mavenCentral,升级到classpath 'com.android.tools.build:gradle:4.2.0'。之后,我收到“针对 Android 12 的清单合并失败”错误,我通过这篇文章解决了这个问题:stackoverflow.com/questions/67654506/… 现在终于可以运行了。你是明星搭档谢谢!
猜你喜欢
  • 1970-01-01
  • 2021-04-01
  • 1970-01-01
  • 2014-10-04
  • 1970-01-01
  • 2023-03-19
  • 2021-05-19
  • 1970-01-01
  • 2022-08-19
相关资源
最近更新 更多