Flutter出现Could not resolve all files for configuration ‘:app:debugCompileClasspath’.
问题:使用Flutter在Windows11上运行安卓项目,出现报错
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform x86_64_debug-1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a.jar (io.flutter:x86_64_debug:1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Could not download x86_64_debug-1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a.jar (io.flutter:x86_64_debug:1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a)
> Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a/x86_64_debug-1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a.jar'.
> Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a/x86_64_debug-1.0.0-1425e5e9ec5eeb4f225c401d8db69b860e0fde9a.jar'.
> Got socket exception during request. It might be caused by SSL misconfiguration
> 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 10s
解决:
项目目录/android/build.gradle.kts。 不挂梯子试一遍,不行挂梯子再试一遍
allprojects {
repositories {
// 先从maven仓库获取
mavenCentral()
// maven出问题,再从阿里云获取
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://maven.aliyun.com/repository/jcenter") }
maven { url = uri("https://maven.aliyun.com/nexus/content/groups/public") }
maven { url = uri("https://storage.flutter-io.cn/download.flutter.io") }
}
}