赞
踩
问题描述:按照flutter官网步骤安装Flutter SDK、Android studio等,在创建第一个flutter项目后run的过程一直是Running Gradle task ‘assembleDebug’…
解决方法:
1、修改android\build.gradle文件
buildscript { repositories { //修改的地方 //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' } } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' } } allprojects { repositories { //修改的地方 //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' } } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } task clean(type: Delete) { delete rootProject.buildDir }
2、修改Flutter的配置文件, 该文件在Flutter安装目录/packages/flutter_tools/gradle/flutter.gradle
buildscript {
repositories {
//修改的地方
//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' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
按照网上的一些说法,此时重新run项目即可解决,但我的仍然报错,继续修改配置文件:
3、继续修改 Flutter安装目录/packages/flutter_tools/gradle/flutter.gradle文件
private static final String MAVEN_REPO = "https://storage.googleapis.com/download.flutter.io";
修改为
private static final String MAVEN_REPO = "https://storage.flutter-io.cn/download.flutter.io";
(也有的修改为:
private static final String MAVEN_REPO = "https://mirrors.tuna.tsinghua.edu.cn/flutter/download.flutter.io";
或
private static final String MAVEN_REPO = "http://download.flutter.io";
供参考
)
4、修改文件Flutter安装目录/packages/flutter_tools/gradle/resolve_dependencies.gradle
第20行的maven为:
maven {
url "http://download.flutter.io"
}
此时重新run项目,成功运行。
(另外网上有另一种解决方法,没有尝试过)
仅此记录,仅供参考
End
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。