Flutter运行一直卡在 Running Gradle tas
2023-03-30 本文已影响0人
下线的时候
1.找到fultter SDK
所在文件夹的位置:依次进入 flutter/packages/flutter_tools/gradle
文件夹
1.1将buildscript repositories 下面的
buildscript {
repositories {
google()
mavenCentral()
}
...
}
修改为
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
}
...
}
1.2 将DEFAULT_MAVEN_HOST 值修改成 "https://storage.flutter-io.cn"
private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
2 回到当前项目中,将android/build.gradle 文件中两处google() ,jcenter()替换掉,
buildscript {
...
repositories {
// google()
// mavenCentral()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
}
...
}
allprojects {
repositories {
// google()
// mavenCentral()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
}
}