1.首先确认按照flutter中文网快速开始导航https://flutterchina.club/get-started/install/ windows系统安装步骤全部完成(flutter sdk 环境变量配置等)
2.命令行执行 flutter doctor,如果有×存在,按照提示,执行提示命令补全证书,解决号×号
3.Google服务器在国外,国内选用阿里云服务器,修改两个地方的配置: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配置文件, 该文件在`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.2.1'
}
}
一般情况这几步就ok了,如果还卡在那里,试试第四个步骤
4.防火墙 打开系统控制面板 -- 系统安全 -- windows 防火墙 -- 允许应用程序通过防火墙 -- 把Android sdk安装目录里面的 studio64.exe和Android studio.exe添加到程序列表.