Flutter新建项目运行报错Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac‘.
程序员文章站
2022-06-01 17:53:46
...
Flutter新建项目运行报错,错误如下
这个问题是Google被墙了,需要配置阿里云镜像
第一步:修改android目录下的build.gradle文件中的
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' }
maven { url 'http://download.flutter.io'}
}
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' }
maven { url 'http://download.flutter.io'}
}
}
第二步:修改flutter sdk下的flutter.gradle文件,具体目录是flutter\packages\flutter_tools\gradle
buildscript {
repositories {
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异常捕获在项目中的应用
下一篇: Key——那么熟悉又那么陌生