Flutter编译卡在Running Gradle task ‘assembleDebug

1、翻墙

2、修改国内镜像源(以下以Flutter 3.19.3版本为例)

  1. 找到Flutter SDK目录下的Flutter配置文件resolve_dependencies.gradle

路径:flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle

1)、第一处修改:

google()

mavenCentral()

改为:

maven { url 'https://maven.aliyun.com/repository/central' }

maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }

maven { url 'https://maven.aliyun.com/repository/google' }

maven { url 'https://maven.aliyun.com/repository/public'}

2)、第二处修改:

url "storageUrl/{engineRealm}download.flutter.io"

改为:url "https://mirrors.tuna.tsinghua.edu.cn/flutter/download.flutter.io"

  1. 找到Flutter SDK目录下的Flutter配置文件flutter.groovy

地址为: flutter/packages/flutter_tools/gradle/src/main/groovy

1)、第一处修改

google()

mavenCentral()

改为:

maven { url 'https://maven.aliyun.com/repository/central' }

maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }

maven { url 'https://maven.aliyun.com/repository/google' }

maven { url 'https://maven.aliyun.com/repository/public'}

2)、第二处修改

DEFAULT_MAVEN_HOST = "https://storage.googleapis.com";

改为:DEFAULT_MAVEN_HOST = "https://mirrors.tuna.tsinghua.edu.cn/flutter"

3.修改项目根目录下Android/build.gradle文件镜像地址

google()

mavenCentral()

改为:

maven { url 'https://maven.aliyun.com/repository/central' }

maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }

maven { url 'https://maven.aliyun.com/repository/google' }

maven { url 'https://maven.aliyun.com/repository/public'}

4.修改项目gradle下载地址

路径:项目根目录/android/gradle/wrapper/gradle-wrapper.properties

改:

复制代码
        https\://services.gradle.org/distributions/gradle-xx.zip

为:

复制代码
        https://mirrors.cloud.tencent.com/gradle/gradle-xx.zip

over!

相关推荐
Summer不秃2 小时前
Flutter之使用mqtt进行连接和信息传输的使用案例
前端·flutter
旭日猎鹰2 小时前
Flutter踩坑记录(二)-- GestureDetector+Expanded点击无效果
前端·javascript·flutter
sunly_2 小时前
Flutter:AnimatedSwitcher当子元素改变时,触发动画
flutter
AiFlutter2 小时前
Flutter封装Coap
flutter
旭日猎鹰8 小时前
Flutter踩坑记录(三)-- 更改入口执行文件
flutter
旭日猎鹰8 小时前
Flutter踩坑记录(一)debug运行生成的项目,不能手动点击运行
flutter
️ 邪神8 小时前
【Android、IOS、Flutter、鸿蒙、ReactNative 】自定义View
flutter·ios·鸿蒙·reactnative·anroid
比格丽巴格丽抱19 小时前
flutter项目苹果编译运行打包上线
flutter·ios
SoaringHeart20 小时前
Flutter进阶:基于 MLKit 的 OCR 文字识别
前端·flutter
AiFlutter1 天前
Flutter通过 Coap发送组播
flutter