Figured it out after looking at a few files inside the Android studio settings directory.
If you’ve been upgrading your Android Studio and importing settings from previous installations, this might happen (it might also happen with a fresh installation).
- Go to wherever your Android Studio config folder is located (usually at $HOME/.AndroidStudio2.1/confg).
- Open the Options folder and delete the file jdk.table.xml (keep a backup just in case)
- Restart Android Studio
This fixed the issue for me. The newly created jdk.table.xml will have updated java8 values (which it most probably fetches from the JDK_HOME environment variable).
close android studio
go to :
replace all with your JDK version , in my case replaced all with :