卡在Running Gradle task ‘assembleTgRelease’.很久的解决方案
- 发表于
- flutter
原因:Gradle的Maven仓库在国外,速度较慢或访问超时。
解决方案:设置淘宝镜像
1、修改flutter项目,android目录下的build.gradle
buildscript {
ext.kotlin_version = '1.3.50'
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' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
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' }
}
}
2、修改flutter安装目录下在的flutter.gradle
文件位置:flutter安装路径\flutter\packages\flutter_tools\gradle\flutter.gradle
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' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
private static final String DEFAULT_MAVEN_HOST = "https://storage.googleapis.com";
//修改为
private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
好了,现在再操作就会快很多。
原文连接:卡在Running Gradle task ‘assembleTgRelease’.很久的解决方案
所有媒体,可在保留署名、
原文连接
的情况下转载,若非则不得使用我方内容。