3

With the new Android Studio 1.0 1.0 Release Candidate I am getting this error:

Unsupported major.minor version 51.0

I am using jdk1.7.0_60.jdk

Been trying those but with no success:

Please help

Community
  • 1
  • 1
Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216
  • I guess you don't have Java 7 installed or try to run android studio with a version below 7 – zapl Nov 21 '14 at 22:10
  • @zapl nop, I am using jdk7 – Ilya Gazman Nov 21 '14 at 22:12
  • Version 51 can only be unsupported when you're not using Java 7 or up. Do you have more than 1 java (e.g. an old JRE 6) installed? Type `java -version` into the command line window thing. That should show you what java version is in use. – zapl Nov 21 '14 at 22:14
  • @zapl Java(TM) SE Runtime Environment (build 1.7.0_60-b19) – Ilya Gazman Nov 21 '14 at 22:25
  • Where / how exactly does that error appear? When starting studio? Do you have more than that java installed? Do you have "JAVA_HOME" set (`echo %JAVA_HOME%` on windows / `echo $JAVA_HOME` linux) in command line - studio does `"Locate a JDK installation directory which will be used to run the IDE. Try (in order): STUDIO_JDK, JDK_HOME, JAVA_HOME, "java" in PATH"` (you can check the others as well, somewhere must be a reference to java). Also operating system? – zapl Nov 21 '14 at 23:51

1 Answers1

2

Solution:

Solution for me was to edit Android Studio.app/Contents/Info.plist

Find these two lines towards the bottom:

<key>JVMVersion</key>
<string>1.6*</string>

Change it to 1.7*, so that it looks like so:

<key>JVMVersion</key>
<string>1.7*</string>

Then restart your IDE.


Explanation:

If you're like me, you were prompted to install Java 6 for your Mac when installing Android Studio (before the RC release) because it required that and I didn't have a runtime installed at the time (clean install). This made this the default runtime for the IDE (even if projects within it are built with JDK 7). It seems with 1.0 RC-1, they raised this to 1.7.

You can check the runtime version it's using by going to Android Studio > About Android Studio.

NOTE: This may require you to revert it the next time you want to update with the patch updater, as someone here reported that the patcher fails if you've edited this file. I think this is really dumb and heavy handed by them, and hopefully they address that issue soon.

Zac Sweers
  • 3,101
  • 2
  • 18
  • 20
  • On a side note, it appears that the font rendering is greatly improved after changing this o_O – Zac Sweers Nov 22 '14 at 11:23
  • Improved? The font rendering is now terrible for me. Seems there is no sub pixel rendering... – athor Nov 23 '14 at 21:07
  • That's why mentioned it in a comment and not the answer. Not sure why it changed but it worried out for me. – Zac Sweers Nov 23 '14 at 21:12
  • It's interesting, because I only get that error when trying to use a plugin in my project. If I remove the plugin, the project compiles fine. Is it just a case of compiling the plugin correctly? – athor Nov 23 '14 at 21:22
  • Ah, that might be the case for you. Check the plugin's implementation – Zac Sweers Nov 23 '14 at 21:24