前段时间升级了mac系统到Catalina,然后又升级了android studio到4.0,后来打开flutter项目,执行flutter run 一直卡在Running Gradle task 'assembleDebug'...,等好久都没用,网上搜索了半天,最终解决了问题,记录一下
1.首先 将项目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' }
如下图
image.png2.修改本地的flutter配置文件,flutter安装目录下找到
packages/flutter_tools/gradle/flutter.gradle文件,修改同上
3.还是修改上面那个文件,将MAVEN_REPO 地址替换为 https://storage.flutter-io.cn/download.flutter.io
image.png4.修改packages/flutter_tools/gradle/resolve_dependencies.gradle
替换maven地址为http://download.flutter.io
image.png
网友评论