For those having these issues with the latest Android Studio - Electric Eel version, and other canaries and preview releases, note that the bundled jre
directory in the Android Studio installation folder is now renamed to jbr
To resolve this, just create a sym link jre
-> jbr
and Flutter won't complain.
On Linux
cd ~/android-studio/ && ln -s jbr jre
Windows (check installation folder)
cd C:\Program Files\Android\Android Studio
mklink /D "jre" "jbr"
or
New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr
Mac OS
cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre
Note that if you are running a preview release, and depending on your OS, the default installation directory might be different, e.g. on Linux it would be
~/android-studio-preview/
In either case, you can check the installation directory by running
flutter doctor -v
Also, in case if you run with permissions issues, you can try running the command with admin privileges, depending on your OS.
For example on Mac/Linux, you can just run the same command with sudo
and it should work, additionally on Mac, you'll have to configure the Disk Access permissions, depends on your version, but most probably can be found under:
Settings - Privacy & Security - Full Disk Access - Terminal