【问题标题】:Execution failed for task ':app:mergeDebugResources' in FlutterFlutter 中的任务 ':app:mergeDebugResources' 执行失败
【发布时间】:2021-02-01 16:42:18
【问题描述】:

我是 Flutter 的新手,我只是第一次尝试设置它。我一直在尝试运行每个新项目附带的 Demo App,但 Android Studio 返回此错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
   > Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
     Required by:
         project :app
      > Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
               > dl.google.com
      > Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
               > jcenter.bintray.com
      > Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
         > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
            > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
               > storage.googleapis.com
      > Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
         > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
            > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
               > storage.googleapis.com
      > Could not resolve com.android.tools.build:aapt2:3.5.0-5435860.
         > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
            > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/android/tools/build/aapt2/3.5.0-5435860/aapt2-3.5.0-5435860.pom'.
               > storage.googleapis.com

* 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 12m 38s
Exception: Gradle task assembleDebug failed with exit code 1

我尝试手动(离线)安装 Gradle,同时连接到互联网。但它似乎没有下载它需要的 .pom 文件。我什至尝试过手动下载 .pom 文件,希望找到如何手动将它们放入 Flutter 项目中,但链接(我从控制台复制的)将我带到“错误 404”页面。

这是我的flutter doctor 结果:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.18362.476], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.49.3)
[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

我没有启用代理设置。我试图找到解决此问题的方法,但在任何地方都找不到答案。

【问题讨论】:

  • 你的gradle.properties里面有什么
  • 也许使用 vpn 可以解决问题。

标签: android flutter gradle


【解决方案1】:

我曾经也遇到过这个问题。我所做的只是将我的电脑和设备连接到互联网,问题就解决了。我希望这有效..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-04
    • 1970-01-01
    • 1970-01-01
    • 2015-08-26
    • 1970-01-01
    • 2020-11-18
    • 2021-01-19
    • 2014-04-30
    相关资源
    最近更新 更多