Unable to find bundled Java version on Flutter

I have Android Studio version 3.0
When I use the command flutter doctor it shows me the following,

Unable to find bundled Java version

My current Java version is (build 1.8.0_131-b11)


For Mac User

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

https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/#what-is-usrlibexecjava-home

after that type below command on terminal

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

Edit #1:

For Mac users who are using JetBrains Toolbox, here is the solution:

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

https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/#what-is-usrlibexecjava-home

after that type below command on terminal

change username to your macOS username

cd /Users/username/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7583922/Android Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor -v

if you are using windows go to this directory C:\Program Files\Android\Android Studio and check older Android Studio folders are exist if exist delete those. it will work.