当前位置: 代码迷 >> 综合 >> Flutter运行 Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’等错误解决
  详细解决方案

Flutter运行 Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’等错误解决

热度:88   发布时间:2023-11-04 21:42:55.0

运行Flutter时候出现如下错误:

FAILURE: Build failed with an exception.

* What went wrong:

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.

.................

解决办法:

1、在flutter项目下的 android > build.gradle文件修改repositories,注释google()、jcenter(),添加阿里地址。

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' }mavenLocal()mavenCentral()}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' }mavenLocal()mavenCentral()}
}

2、在flutter sdk 目录下,找到packages\flutter_tools\gradle\flutter.gradle,在repositories中注释google()、jcenter(),添加阿里地址。

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' }mavenLocal()mavenCentral()}dependencies {classpath 'com.android.tools.build:gradle:3.5.0'}
}

 

  相关解决方案