其实说到底就是国内访问google源太慢或者超时,所以两个方案
方案一:让自己能顺利访问google 懂得都懂
方案二:更换镜像地址,一共需要更换一下3个地方
1-更改 flutter/packages/flutter_tools/gradle/flutter.gradle文件
将google、mavencentral换成阿里云的镜像
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 {
/* When bumping, also update ndkVersion above. */
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
2-更改flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle文件文章来源:https://www.toymoban.com/news/detail-635572.html
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' }
maven {
url "$storageUrl/download.flutter.io"
}
}
3-更改android/build.gradle文件文章来源地址https://www.toymoban.com/news/detail-635572.html
同上
buildscript {
ext.kotlin_version = '1.6.10'
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' }
}
}
到了这里,关于flutter打包解决 Running Gradle task ‘assembleRelease‘...死循环问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!