我是Flutter的新手,我只是想第一次进行设置。我一直在尝试运行每个新项目随附的演示应用程序,但是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.
我没有启用代理设置。我试图找到解决此问题的方法,但没有在任何地方找到答案。
答案 0 :(得分:0)
我也遇到过这个问题。我所做的只是将我的计算机和设备连接到互联网,问题就解决了。我希望这有效..