Unable to find bundled Java version with flutter doctor, after updating Android studio Arctic Fox(2020.3.1) on M1 Apple Silicon

Solution 1:

The answer is already posted here.

For Mac User:

Set Java_Home path using below article & then after applying this command.

after that type below command in terminal:

cd /Applications/Android\ Studio.app/Contents/jre

ln -s ../jre jdk

ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

flutter doctor -v

Solution 2:

Here is a little fuller answer for everything I had to do to get Android Studio set up on my M1.

  1. Install Android Studio to the Applications folder

  2. Create a symbolic link to from the jre folder to a new jdk folder. (Due to this bug)

cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
  1. Set the JAVA_HOME environment variable
nano ~/.zshrc
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
source ~/.zshrc
  1. Install Android SDK Command-line Tools (needed for accepting license)

  2. At this point it should work now (assuming you've also added flutter to your path)

flutter doctor

Solution 3:

I did install a fresh version of JAVA SDK, flutter, Android Studio and run the below command directly on the terminal one by one to fix 'Unable to find bundled Java version. ' issue.

  1. cd /Applications/Android\ Studio.app/Contents/jre

  2. ln -s ../jre jdk

  3. ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

  4. flutter doctor -v

Now, you should be able to see the error is disappeared in flutter doctor description in terminal.

Solution 4:

Run Flutter doctor, if there´s an error indicating that the java bundled can´t be found (specially if you have Android Studio version Artic Fox), run this commands if using Mac:

  1. cd /Applications/Android\ Studio.app/Contents/jre

  2. ln -s ../jre jdk

  3. ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

  4. Flutter Doctor

Solution 5:

This solution is for M1 Mac User

  1. Find your local Java version by typing /usr/libexec/java_home -V. If didn't exist, install the latest ARM Java version here
  2. Set Java_Home path (in my case jdk-17.0.1.jdk) by typing /usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
  3. Type all of these in terminal
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
  1. Finally run flutter doctor -v to see all the details changes