请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

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

安卓studio运行模拟器后,启动flutter项目会报错,请问这个报错如何解决

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode…
Running Gradle task ‘assembleDebug’…

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Failed to find Build Tools revision 33.0.1

  • 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 2s
Error: Gradle task assembleDebug failed with exit code 1

正在回答 回答被采纳积分+3

1回答

haharsw 2024-11-27 23:23:31

本地 Java 环境配置检查一下,是否有问题,你可以先运行一下 flutter doctor 这个命令,看看输出的 Android 开发部分是不是正常的。

0 回复 有任何疑惑可以回复我~
  • 提问者 慕村0266627 #1
    除了没安装谷歌浏览器,运行flutter doctor其他项目都是打勾正常的,以下是运行结果:
    C:\Users\lucon>flutter doctor
    Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
    Doctor summary (to see all details, run flutter doctor -v):
    [√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [版本 10.0.22631.4541], locale zh-CN)
    [√] Windows Version (Installed version of Windows is version 10 or higher)
    [√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    [X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
        ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
    [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.1)
    [√] Android Studio (version 2024.2)
    [√] Connected device (3 available)
    [√] Network resources
    
    ! Doctor found issues in 1 category.
    =========================================================
    以下是电脑安装的java情况:
    C:\Users\lucon>java -version
    java version "21.0.4" 2024-07-16 LTS
    Java(TM) SE Runtime Environment (build 21.0.4+8-LTS-274)
    Java HotSpot(TM) 64-Bit Server VM (build 21.0.4+8-LTS-274, mixed mode, sharing)
    回复 有任何疑惑可以回复我~ 2024-11-27 23:33:36
  • haharsw 回复 提问者 慕村0266627 #2
    你可以先把frontend 目录下的 android 文件夹完全删除,然后用终端在 frontend 目录下执行  "flutter create ." 命令,注意这个命令后面的 点 号不能省略,这个命令会重新生成 android 项目,再执行看。如果有什么报错,你可以把错误的关键信息 复制到 GitHub Copilot 中,它也会给出你解决建议。
    回复 有任何疑惑可以回复我~ 2024-11-28 12:55:17
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信