You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter Doctor检测Android工具链超时崩溃问题求助

Flutter Doctor Android工具链超时崩溃问题

问题现象

flutter doctor 输出以下错误:

Checking Android licenses is taking an unexpectedly long time...[☠] Android toolchain - develop for Android devices (the doctor check crashed)
✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
✗ Exception: Android toolchain - develop for Android devices exceeded maximum allowed duration of 0:10:00.000000

已尝试操作

  • 已在Android Studio中安装最新的Android SDK Command-line Tools
  • 执行命令设置SDK路径:flutter config --android-sdk /Users/mooreihu/Library/Android/sdk
  • 尝试运行flutter doctor --android-licenses,但进程无限挂起,无超时提示

目前找不到更多可行方案,请求帮助。

完整flutter doctor -v输出

[✓] Flutter (Channel stable, 3.3.1, on macOS 12.5.1 21G83 darwin-arm, locale en-US)
    • Flutter version 3.3.1 on channel stable at /Users/mooreihu/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4f9d92fbbd (8 days ago), 2022-09-06 17:54:53 -0700
    • Engine revision 3efdf03e73
    • Dart version 2.18.0
    • DevTools version 2.15.0

Checking Android licenses is taking an unexpectedly long time...[☠] Android toolchain - develop for Android devices (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please
      let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ Exception: Android toolchain - develop for Android devices exceeded maximum allowed duration of
      0:10:00.000000
    • 

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Community Edition (version 2022.1.3)
    • IntelliJ at /Users/mooreihu/Library/Application
      Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.69.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 12.5.1 21G83 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 105.0.5195.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

可行解决方案

方法1:手动调用sdkmanager处理许可证

绕开Flutter的封装,直接用Android SDK自带工具处理:

  1. 终端进入Android SDK的cmdline-tools目录,比如:cd /Users/mooreihu/Library/Android/sdk/cmdline-tools/latest/bin
  2. 执行命令:./sdkmanager --licenses
  3. 出现许可证确认提示时,全部输入y完成接受

方法2:检查并配置Java环境变量

确保Flutter使用的是Android Studio自带的JDK:

  • 终端执行echo $JAVA_HOME,确认路径为/Applications/Android Studio.app/Contents/jre/Contents/Home
  • 若路径不对,在~/.zshrc或~/.bash_profile中添加:
    export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"
    export PATH="$JAVA_HOME/bin:$PATH"
    
  • 执行source ~/.zshrc或source ~/.bash_profile生效后,重新运行flutter doctor

方法3:清理Flutter缓存重置配置

  1. 执行flutter clean清理项目缓存
  2. 执行flutter doctor --reset-packages重置Flutter包配置
  3. 最后重新运行flutter doctor

方法4:切换Flutter通道尝试

稳定版的bug可能在测试通道已修复:

  • 切换到beta通道:flutter channel beta
  • 升级Flutter:flutter upgrade
  • 再运行flutter doctor

内容的提问来源于stack exchange,提问作者mourningraptor3

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 06:30:50