22

enter image description hereenter image description here

Inspite of having JDK 8 installed, I'm getting this error. What can the issue be?

LEE
  • 3,335
  • 8
  • 40
  • 70
  • try `$ whereis java` and `$ which java` in terminal to find out where your Java installation is...tbh I'm not quite sure about that location... – cipley Aug 31 '16 at 04:05
  • Also, when I click on "Install a supported JDK" I'm getting a broken link. – Suragch Sep 01 '16 at 01:19

5 Answers5

50
  1. Check installed java version, it should be 1.8 or later.

MBP-Vitaliy:~$ java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
  1. Check java version in Android Studio. In Mac OS X: Android Studio -> About Android Studio. Where JRE should be 1.8 or later.

  2. If you have another, In Mac OS X go to Applications folder find AndroidStudio.app and click Show content, then find in Content folder Info.plist file and change JVM VERSION to 1.8 manually.

<key>JVMVersion</key>
<string>1.8</string>
  1. Restart Android Studio.
Vitalii Movchan
  • 630
  • 7
  • 4
5

for mac users @Vitaliy Movchan answer works.

for windows users (who has to set JAVA_HOME in their operative system):

  • Install the JDK 1.8 and note the destination path, usually C:\Program Files\Java\jdk1.8.0_xx
  • Right-click My Computer and select Properties.
  • Click the Advanced System Settings link in the left column.
  • In the tab Advanced click Environment Variables
  • Create or modify the variable JAVA_HOME.
  • Enter the variable value as the installation path for the Java Development Kit.
Bronx
  • 4,480
  • 4
  • 34
  • 44
2

You can still get the layout rendered during design time in the IDE if you choose Android version 23 (Marshmallow) rather than version 24 (Nougat).

enter image description here

This isn't a long-term solution, but for most purposes it should be good enough. You can always see the actual Nougat layout by running your app in the Android emulator.

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
1

Add JVMVersion 1.8*, 1.8+ to info.plist of android studio app and also check for default java version

-1

I had the same problem, in my system i have installed 3 jdks. jdk1.6, jkd1.7, and jdk1.8. I am working on some projects which requires jdk 1.7 so i can't change JAVA_HOME.

So i have found another solution by tell android studio which JAVA_HOME needs to be used.

So i just edit studio.sh file and added JAVA_HOME variable.

JAVA_HOME = /usr/lib/jvm/java-8-oracle/

studio.sh file

After Restart android-studio started pointing to jdk 1.8. Hope this will help.

ROHIT
  • 185
  • 1
  • 3
  • 17