A problem occurred evaluating project ':app'.> Could not resolve all artifacts for configuration 'classpath'. > Could not find com.android.tools.build:gradle:3.2.1. Searched in the following locations: - https://maven.aliyun.com/repository/jcenter/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom - https://maven.aliyun.com/repository/jcenter/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar - http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom - http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar Required by: unspecified:unspecified:unspecified
第一步:修改掉项目下的 android目录下的 build.gradle 文件,把 google() 和 jcenter()这两行去掉。
并在下面添加阿里的链接 (注意:有两处修改)
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
第二步:修改 Flutter SDK 包下的 flutter.gradle 文件
路径根据你的sdk存放位置,例如我的是D:\SDK\Flutter\packages\flutter_tools\gradle\flutter.gradle
同样将 google()和 jcenter() 修改为阿里的链接
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
第三步:若出现下图
看到这里说明阿里链接是配置上了的,之所以找不到是因为gradle-3.2.1这个3.2.1版本太高了,应该是最新的
阿里连接中的gradle最高版本好像才3.1.2,所以获取不到
所以,解决办法是将项目下的android目录下的build.gradle文件和flutter SDK包下的flutter.gradle文件中的gradle版本改为阿里镜像中存在的版本
网友评论