Flutter构建失败,ERROR:Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
第一种方法:
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'.
   > Could not find io.flutter:flutter_embedding_debug:1.0.0-33ad6757e88311f4fb9d341918894e2bc30e3b20.
     Required by:
         project :app
   > Could not find io.flutter:arm64_v8a_debug:1.0.0-33ad6757e88311f4fb9d341918894e2bc30e3b20.
     Required by:
         project :app
   > Could not find io.flutter:x86_debug:1.0.0-33ad6757e88311f4fb9d341918894e2bc30e3b20.
     Required by:
         project :app
   > Could not find io.flutter:x86_64_debug:1.0.0-33ad6757e88311f4fb9d341918894e2bc30e3b20.
     Required by:
         project :app

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 27s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        27.7s
Gradle task assembleDebug failed with exit code 1

粗暴的办法.gradle文件夹是指当前app下android目录下的.gradle,clean操作是指在当前app根目录下运行flutter clean命令。(试了一下对我来说没有用处)

第二种方法:

因为xxx造成的无法访问Google,导致编译不成功,修改flutter安装目录下的\packages\flutter_tools\gradle\flutter.gradle文件
在这里插入图片描述
将 private static final String MAVEN_REPO = "https://storage.googleapis.com/download.flutter.io";
修改为:
private static final String MAVEN_REPO = "https://storage.flutter-io.cn/download.flutter.io";

保存再次执行 flutter run 即可正常运行。

第三种方法:

如果还不成功,可以尝试将android目录下的build.gradle文件和flutter安装目录下的\packages\flutter_tools\gradle\flutter.gradle的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' }

在这里插入图片描述

我这里使用网易mumu来测试
在这里插入图片描述
如此第一个flutter就开启成功了

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐