原因
运行时会卡在Running ‘gradle assembleDebug, 因为Gradle的Maven仓库在国外, 可以使用阿里云的镜像地址。
解决办法
1 打开项目:
buildscript {
ext.kotlin\_version = '1.3.50'
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'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin\_version"
}
}
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' }
}}
2 打开flutter目录
D:\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'
}
}
再重新运行flutter app ,就可以成功了
3 包导入报错
命令行里运行 flutter packages get