赞
踩
按照flutter官网步骤安装Flutter SDK、Android studio等,
在创建第一个flutter项目后run的过程一直是Running Gradle task ‘assembleDebug’…
针对这个问题,现在给出解决方法
修改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 }
修改Flutter的配置文件, 该文件在FlutterSDK安装目录/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'
}
}
继续修改 FlutterSDK安装目录/packages/flutter_tools/gradle/flutter.gradle文件
private static final String MAVEN_REPO = "https://storage.googleapis.com/download.flutter.io";
修改为
private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
修改FlutterSDK安装目录/packages/flutter_tools/gradle/resolve_dependencies.gradle文件
第20行的maven为:
maven {
url "http://download.flutter.io"
}
然后重启Android Studio,再次运行就可以了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。