💊

flutter doctorで「Unable to find bundled Java version.」となる場合の解決法

2 min read 1

Javaがインストールされているのに flutter doctor でAndroid StudioがJavaを認識しない場合の解決法をメモしておきます。

2021/9/9追記

Flutterのバージョンを 2.5.0 に更新すると問題が発生しなくなりました。

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-arm, locale ja-JP)
[] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[] Xcode - develop for iOS and macOS
[] Chrome - develop for the web
[] Android Studio (version 2020.3)
[] VS Code (version 1.60.0)
[] Connected device (1 available)

• No issues found!

環境

  • M1 MacBook Air
  • macOS Big Sur 11.3.1
  • Android Studio Arctic Fox 2020.3.1
  • Flutter 2.2.3
$ java --version
openjdk 11.0.12 2021-07-20 LTS
OpenJDK Runtime Environment Zulu11.50+19-CA (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM Zulu11.50+19-CA (build 11.0.12+7-LTS, mixed mode)

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 2.2.3, on macOS 11.3.1 20E241 darwin-arm, locale ja-JP)
[] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[] Xcode - develop for iOS and macOS
[] Chrome - develop for the web
[!] Android Studio (version 2020.3)
    ✗ Unable to find bundled Java version.
[] VS Code (version 1.59.0)
[] Connected device (1 available)

! Doctor found issues in 1 category.

解決法

$ cd /Applications/Android\ Studio.app/Contents/jre
$ ln -s ../jre jdk
$ ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 2.2.3, on macOS 11.3.1 20E241 darwin-arm, locale ja-JP)
[] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[] Xcode - develop for iOS and macOS
[] Chrome - develop for the web
[] Android Studio (version 2020.3)
[] VS Code (version 1.59.0)
[] Connected device (1 available)

• No issues found!

参考リンク

Discussion

この記事に救われました...!!
ありがとうございます

ログインするとコメントできます