Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find bundled Java version. #76215

Closed
ashut08 opened this issue Feb 17, 2021 · 41 comments
Closed

Unable to find bundled Java version. #76215

ashut08 opened this issue Feb 17, 2021 · 41 comments
Labels
r: timeout Issue is closed due to author not providing the requested details in time

Comments

@ashut08
Copy link

ashut08 commented Feb 17, 2021

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.7-0.0.pre.2, on Linux, locale en_US.UTF-8)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Android Studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    ✗ android-studio-dir = /home/ashu/Downloads/android-studio-ide-201.7042882-linux/android-studio/bin
    ✗ Unable to find bundled Java version.
[✓] VS Code (version 1.53.2)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.
@iapicca
Copy link
Contributor

iapicca commented Feb 17, 2021

@ashut08
can you double check that these are present ion your .bashrc

export PATH="$PATH:/usr/bin/java"
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre

if the issue persists please provide the output of:

  • flutter doctor -v
  • java -version
  • which java
  • cat ~/.bashrc

@ashut08
Copy link
Author

ashut08 commented Feb 18, 2021

Error are persistent attaching output of the follow command

  • flutter doctor -v

  • java -version

  • which java

  • cat ~/.bashrc

  • flutter doctor -v


[✓] Flutter (Channel stable, 1.22.7-0.0.pre.2, on Linux, locale en_US.UTF-8)
    • Flutter version 1.22.7-0.0.pre.2 at
      /home/ashu/flutter_linux_1.22.6-stable/flutter
    • Framework revision 7bffa304a4 (2 days ago), 2021-02-16 14:16:18 +0530
    • Engine revision 2f0af37152
    • Dart version 2.10.5
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/ashu/Android/Sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java
    ✗ Cannot execute /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java to
      determine the version

[!] Android Studio
    • Android Studio at
      /home/ashu/android-studio-ide-201.7042882-linux/android-studio/bin
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    ✗ android-studio-dir =
      /home/ashu/android-studio-ide-201.7042882-linux/android-studio/bin
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.
    • Consider removing your android-studio-dir setting by running:
      flutter config --android-studio-dir=

[✓] VS Code (version 1.53.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.19.0

[✓] Connected device (1 available)
    • Redmi Y3 (mobile) • 666b7162 • android-arm64 • Android 9 (API 28)

! Doctor found issues in 2 categories.

  • java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
  • which java
    bin/java

  • cat ~/.bashrc

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
export PATH="$PATH:/home/ashu/flutter_linux_1.22.6-stable/flutter/bin"
export PATH="$PATH:/usr/bin/java"
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk/jre

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions


@TahaTesser
Copy link
Member

Hi @ashut08
Can you please switch the correct latest stable versions and try again, which is 1.22.6?

flutter channel stable
flutter upgrade --force
flutter doctor -v

flutter doctor -v
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.1 20D74 darwin-x64, locale en-GB)
    • Flutter version 1.22.6 at /Users/tahatesser/Code/flutter_stable
    • Framework revision 9b2d32b605 (4 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
      You may also want to add it to your PATH environment variable.
[!] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install:
        sudo gem install cocoapods
[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.53.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.19.0
[!] Connected device
    ! No devices available
! Doctor found issues in 4 categories.

Thank you

@TahaTesser TahaTesser added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Feb 18, 2021
@pedromassangocode
Copy link

Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v.
All system setups can be slightly different, so it's always better to open new issues and reference related issues.

@pedromassangocode pedromassangocode added r: timeout Issue is closed due to author not providing the requested details in time and removed in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Mar 12, 2021
@samridhgupta
Copy link

samridhgupta commented Jun 5, 2021

Had this issue of ✗ Unable to find bundled Java version.
Seems like the issue was with Android Studio (Beta Version)

Changed my Android Studio (Stable Version) to solve the issue

Here are the flutter doctor -v details for each Android Studio

Beta Android Studio

[!] Android Studio
    • Android Studio at /Applications/Android Studio Preview.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

Stable Android Studio

[✓] Android Studio (version 4.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.8+10-b944.6916264)

Even after this issue persist then

  • Check for Java
    java -version
    which java

  • double-check that these are present in your .bashrc or .bash_profile or .zshrc

export PATH="$PATH:/usr/bin/java"
export JAVA_HOME=$(/usr/libexec/java_home)

@Amarjitt
Copy link

i am having this issue unable to find bundled java version after running flutter doctor help me to resolve this issue!

flutter doctor -v

            Doctor summary (to see all details, run flutter doctor -v):
            [✓] Flutter (Channel stable, 2.2.1, on Linux, locale en_IN)
            [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
            [✓] Chrome - develop for the web
            [✓] Android Studio (version 4.2)
            [!] Android Studio
                ✗ Unable to find bundled Java version.
            [✓] Connected device (1 available)
            
            ! Doctor found issues in 1 category.
            amar-nix@amarnix-Vostro-3478:~$ flutter doctor -v
            [✓] Flutter (Channel stable, 2.2.1, on Linux, locale en_IN)
                • Flutter version 2.2.1 at /opt/flutter_linux_2.2.1-stable/flutter
                • Framework revision 02c026b03c (2 weeks ago), 2021-05-27 12:24:44 -0700
                • Engine revision 0fdb562ac8
                • Dart version 2.13.1
            
            [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
                • Android SDK at /home/amar-nix/Documents/androidSdk
                • Platform android-30, build-tools 30.0.3
                • ANDROID_HOME = /home/amar-nix/Documents/androidSdk
                • Java binary at: /opt/android-studio/android-studio/jre/bin/java
                • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)
                • All Android licenses accepted.
            
            [✓] Chrome - develop for the web
                • Chrome at google-chrome
            
            [✓] Android Studio (version 4.2)
                • Android Studio at /opt/android-studio/android-studio
                • Flutter plugin version 57.0.2
                • Dart plugin version 202.8488
                • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)
            
            [!] Android Studio
                • Android Studio at /opt/android-studio
                • 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
                ✗ Unable to find bundled Java version.
                • Try updating or re-installing Android Studio.
            
            [✓] Connected device (1 available)
                • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.101
            
            ! Doctor found issues in 1 category.

java -v command

              openjdk 14.0.2 2020-07-14
              OpenJDK Runtime Environment (build 14.0.2+12-Ubuntu-120.04)
              OpenJDK 64-Bit Server VM (build 14.0.2+12-Ubuntu-120.04, mixed mode, sharing)

which java

              /usr/bin/java

.bashrc file

              # ~/.bashrc: executed by bash(1) for non-login shells.
              # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
              # for examples
              
              # If not running interactively, don't do anything
              case $- in
                  *i*) ;;
                    *) return;;
              esac
              
              # don't put duplicate lines or lines starting with space in the history.
              # See bash(1) for more options
              HISTCONTROL=ignoreboth
              
              # append to the history file, don't overwrite it
              shopt -s histappend
              
              # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
              HISTSIZE=1000
              HISTFILESIZE=2000
              
              # check the window size after each command and, if necessary,
              # update the values of LINES and COLUMNS.
              shopt -s checkwinsize
              
              # If set, the pattern "**" used in a pathname expansion context will
              # match all files and zero or more directories and subdirectories.
              #shopt -s globstar
              
              # make less more friendly for non-text input files, see lesspipe(1)
              [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
              
              # set variable identifying the chroot you work in (used in the prompt below)
              if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
                  debian_chroot=$(cat /etc/debian_chroot)
              fi
              
              # set a fancy prompt (non-color, unless we know we "want" color)
              case "$TERM" in
                  xterm-color|*-256color) color_prompt=yes;;
              esac
              
              # uncomment for a colored prompt, if the terminal has the capability; turned
              # off by default to not distract the user: the focus in a terminal window
              # should be on the output of commands, not on the prompt
              #force_color_prompt=yes
              
              if [ -n "$force_color_prompt" ]; then
                  if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
                  # We have color support; assume it's compliant with Ecma-48
                  # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
                  # a case would tend to support setf rather than setaf.)
                  color_prompt=yes
                  else
                  color_prompt=
                  fi
              fi
              
              if [ "$color_prompt" = yes ]; then
                  PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
              else
                  PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
              fi
              unset color_prompt force_color_prompt
              
              # If this is an xterm set the title to user@host:dir
              case "$TERM" in
              xterm*|rxvt*)
                  PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
                  ;;
              *)
                  ;;
              esac
              
              # enable color support of ls and also add handy aliases
              if [ -x /usr/bin/dircolors ]; then
                  test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                  alias ls='ls --color=auto'
                  #alias dir='dir --color=auto'
                  #alias vdir='vdir --color=auto'
              
                  alias grep='grep --color=auto'
                  alias fgrep='fgrep --color=auto'
                  alias egrep='egrep --color=auto'
              fi
              
              # colored GCC warnings and errors
              #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
              
              # some more ls aliases
              alias ll='ls -alF'
              alias la='ls -A'
              alias l='ls -CF'
              
              # Add an "alert" alias for long running commands.  Use like so:
              #   sleep 10; alert
              alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
              
              # Alias definitions.
              # You may want to put all your additions into a separate file like
              # ~/.bash_aliases, instead of adding them here directly.
              # See /usr/share/doc/bash-doc/examples in the bash-doc package.
              
              if [ -f ~/.bash_aliases ]; then
                  . ~/.bash_aliases
              fi
              
              # enable programmable completion features (you don't need to enable
              # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
              # sources /etc/bash.bashrc).
              if ! shopt -oq posix; then
                if [ -f /usr/share/bash-completion/bash_completion ]; then
                  . /usr/share/bash-completion/bash_completion
                elif [ -f /etc/bash_completion ]; then
                  . /etc/bash_completion
                fi
              fi
              export FLUTTER_PATH="/opt/flutter_linux_2.2.1-stable/flutter/bin"
              export ANDROID_HOME="/home/amar-nix/Documents/androidSdk"
              export ANDROID_TOOLS="/home/amar-nix/Documents/androidSdk/tools"
              export ANDROID_PLATFORM_TOOLS="/home/amar-nix/Documents/androidSdk/platform-tools"
              export ANDROID_COMMAND_LINE_TOOLS="/home/amar-nix/Documents/androidSdk/cmdline-tools/latest/bin"
              export PATH="$PATH:/usr/bin/java"
              export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
              
              
                             PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:$ANDROID_COMMAND_LINE_TOOLS:$FLUTTER_PATH:$JAVA_HOME/bin

@RblSb
Copy link

RblSb commented Jun 19, 2021

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

@akhatriST
Copy link

Anyone who is still facing this error, follow the below instructions

Just rename your Android Studio Preview to Preview Android Studio, and you are good to go.

@ecerroni
Copy link

@RblSb Thanks. This worked for. me too.

@EdungDivinefavour
Copy link

EdungDivinefavour commented Jul 3, 2021

Jeez it fixed my problem as well @RblSb

Thanks!!

@zuhairhd
Copy link

zuhairhd commented Jul 7, 2021

I just uninstall android studio and then I installed android studio again and update the plugin. It works fine for me

@shamnex
Copy link

shamnex commented Jul 10, 2021

Anyone who is still facing this error, follow the below instructions

Just rename your Android Studio Preview to Preview Android Studio, and you are good to go.

LOL this worked for me as well.

@kishorekumaru
Copy link

kishorekumaru commented Jul 18, 2021

great this worked on my mac m1

@Cyclic
Copy link

Cyclic commented Jul 29, 2021

/Applications/Android Studio Preview.app/Contents/jre/Contents

This also resolves the stable channel release from July 28. Wonky.

@yfer
Copy link

yfer commented Jul 30, 2021

it is fixed on master channel so you can do:

flutter channel master
flutter upgrade

and change back when fix in stable

@jeeali
Copy link

jeeali commented Jul 31, 2021

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

Solved ✅

@AbdulazizAlnahhas
Copy link

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

Work for me

@alatyar
Copy link

alatyar commented Aug 4, 2021

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

Work for me

please if you can tell me how I can make it , Im new

@alatyar
Copy link

alatyar commented Aug 4, 2021

I don't find this /Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

@rajaarav0
Copy link

Anyone who is still facing this error, follow the below instructions

Just rename your Android Studio Preview to Preview Android Studio, and you are good to go.

Where do you find this file?

@paulinavita
Copy link

@RblSb thanks! this works.

Maybe for those who can't find it:

  1. Right click on your android studio app
  2. Show package contents
  3. Go to the jre folder, mkdir jdk
  4. Paste the Contents folder there

@ghost
Copy link

ghost commented Aug 6, 2021

On Mac Big Sur it isn't called Android Studio Preview, it's called Android Studio.app

When I changed it to Android Studio Preview.app, then ran flutter doctor I sure didn't have a java problem anymore, instead I got "Android Studio (not installed)"

@hcl34844
Copy link

hcl34844 commented Aug 7, 2021

Hi Team,

I am using macOS Catalina (Version 10.15.7) and getting the below error. Unable to find bundled Java version.

My Java Version
gaurav_shar@LP-abc~ % java -version
java version "11.0.10" 2021-01-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)

gaurav_shar@LP-abc ~ % which java
/usr/bin/java

gaurav_shar@LP-abc ~ % which javac
/usr/bin/javac

gaurav_shar@LP-abc ~ % javac -version
javac 11.0.10

gaurav_shar@LP-abc ~ %flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.7 19H524 darwin-x64,
locale en-IN)
• Flutter version 2.2.3 at /Users/gaurav_shar/Study/flutter/flutter
• Framework revision f4abaa0 (5 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/gaurav_shar/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at:
/Library/Java/JavaVirtualMachines/jdk-11.0.10.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment 18.9 (build
11.0.10+8-LTS-162)
• All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin
code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.

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

[!] Android Studio (version 2020.3)
• 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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] VS Code (version 1.58.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0

[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 83.0.4103.106

! Doctor found issues in 2 categories.

@nosahama
Copy link

nosahama commented Aug 8, 2021

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

Thanks, this worked for me ❤️

@nosahama
Copy link

nosahama commented Aug 8, 2021

Anyone who is still facing this error, follow the below instructions
Just rename your Android Studio Preview to Preview Android Studio, and you are good to go.

Where do you find this file?

Remove the Preview, so it's /Applications/Android Studio.app/Contents/jre/Contents, then you make a jdk folder and copy the contents of jre.

mkdir -p "/Applications/Android Studio.app/Contents/jre/jdk/Contents"; cp -rf "/Applications/Android Studio.app/Contents/jre/Contents" "/Applications/Android Studio.app/Contents/jre/jdk/"

@yfer
Copy link

yfer commented Aug 9, 2021

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

For me it only works when i do rm -rf flutter/bin/cache as even after file change, tool is still not rebuild, and use old code.

@demongodYY
Copy link

demongodYY commented Aug 16, 2021

This resolution solved my issue, it seems android studio version arctic-fox2020-3-1 problem:
https://exerror.com/unable-to-find-bundled-java-version-after-updated-android-studio-arctic-fox2020-3-1-flutter/

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

@luongvo
Copy link

luongvo commented Aug 17, 2021

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

This works for me.

@zulothman
Copy link

zulothman commented Aug 18, 2021

for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

This works for me. Create the /jdk/Contents dir in /Applications/Android.app/Contents/jre/ and copy the whole contents of /Applications/Android Studio.app/Contents/jre/Contents to /Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

Thanks

@bellib
Copy link

bellib commented Aug 21, 2021

@RblSb thanks! this works.

Maybe for those who can't find it:

  1. Right click on your android studio app
  2. Show package contents
  3. Go to the jre folder, mkdir jdk
  4. Paste the Contents folder there

worked for me thank you

@karmakaze
Copy link

The problem seems to be that the jdk/jre directory isn't where Android Studio expects it, and /usr/bin/java can't find it through JAVA_HOME.

What worked for me on Big Sur was to add the following line to $HOME/.zshrc

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"

Then restart Android Studio.

@devcybiko
Copy link

For me and my M1 Macbook 13" the problem was that I installed Android Studio.app in a local folder (~/stack/Android Studio.app).

The "copy jre ->jre/jdk" solution corrupted the .app folder

What worked for me was installing Android Studio.app in my /Applications folder

Here's my fluttter doctor -v output:

~$ flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-arm, locale
    en-US)
    • Flutter version 2.2.3 at /Users/greg/stack/flutter
    • Framework revision f4abaa0735 (7 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/greg/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.2

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

[✓] Android Studio (version 4.1)
    • 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
      1.8.0_242-release-1644-b3-6915495)

[✓] Android Studio (version 4.1)
    • 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
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.59.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.25.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159

• No issues found!

@EternalYouth29
Copy link

EternalYouth29 commented Aug 22, 2021

The problem seems to be that the jdk/jre directory isn't where Android Studio expects it, and /usr/bin/java can't find it through JAVA_HOME.

What worked for me on Big Sur was to add the following line to $HOME/.zshrc

export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"

Then restart Android Studio.

I was able to run flutter project, and no issues found in flutter doctor -v, but not unable to generate debug certificate fingerprints using keytool . Got error "The operation couldn’t be completed. Unable to locate a Java Runtime." .

And this works. Thanks.

ps: my path is /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home

@hqdung99
Copy link

hqdung99 commented Aug 22, 2021

it is fixed on master channel so you can do:

flutter channel master
flutter upgrade

and change back when fix in stable

Thank yfer, it work for me

@al-sadi
Copy link

al-sadi commented Aug 26, 2021

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

Thanks a lot it worked on (Android Studio Arctic Fox | 2020.3.1 Patch 1
Build #AI-203.7717.56.2031.7621141, built on August 7, 2021
). Hope the fix will reach the stable channel soon.

@dashPreetam
Copy link

dashPreetam commented Sep 5, 2021

For JetBrains ToolBox, MBP (m1), JDK 1.8) users

copy folder:
/Users/$USER/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android Studio.app/Contents/jre/Contents
TO
/Users/$USER/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android Studio.app/Contents/jre/jdk/Contents

@cloudy-ninja
Copy link

globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home') :

There should be check for
join(directory, 'jre', 'Contents', 'Home') instead of
join(directory, 'jre', 'jdk', 'Contents', 'Home')
for newest android studio previews (at least on macos).
Workaround for such people: copy folder
/Applications/Android Studio Preview.app/Contents/jre/Contents to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

It worked for me

@lennonjesus
Copy link

For JetBrains ToolBox, MBP (m1), JDK 1.8) users

copy folder:
/Users/$USER/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android Studio.app/Contents/jre/Contents
TO
/Users/$USER/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android Studio.app/Contents/jre/jdk/Contents

It worked for me. Thanks!

@thubamamba
Copy link

Rename Android Studio Preview to Android Studio then follow these instructions:

  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

@ugurberkecan
Copy link

For JetBrains ToolBox, MBP (m1), JDK 1.8) users

copy folder:
/Users/$USER/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android Studio.app/Contents/jre/Contents
TO
/Users/$USER/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android Studio.app/Contents/jre/jdk/Contents

it's worked but I can't build an apk after applying this.

@github-actions
Copy link

github-actions bot commented Oct 6, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: timeout Issue is closed due to author not providing the requested details in time
Projects
None yet
Development

No branches or pull requests