AppEnginePlugin : Unsupported major.minor version

2019-03-31 01:44发布

After I updated to Android Studio 1.0 RC I get this error:

AppEnginePlugin : Unsupported major.minor version 51.0

Since appengine is compiled with java 1.7 why does it say it's not supported?

Here is my java version:

java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

4条回答
神经病院院长
2楼-- · 2019-03-31 02:12

(copied from my solution here)

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.

The plugin reference is misleading (same happened with me). 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.

查看更多
叼着烟拽天下
3楼-- · 2019-03-31 02:15

On Mac Right Click on Project->Module settings->SDK Location->JDK location Change JdkLocation path to point to 1.7

查看更多
4楼-- · 2019-03-31 02:20
  1. Android Studio -> File -> Project Structure
  2. SDK Location -> JDK Location
  3. Change the location here from 1.6 to 1.7
查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-03-31 02:35

When the Android Studio starts, it checks for JAVA_HOME environment variable. Mostly you would have hardcoded/set this variable somewhere. Check it's value by typing below in terminal/shell:

echo $JAVA_HOME

Like you have stated already,

> Unsupported major.minor version 51.0 ==> JDK 1.7 / 7

That implies the plugin has been compiled in higher version[1.7] and you are trying to run in lower version[<1.7] runtime environment.

You may then set/export the environment variable to point to correct version appropriately. In Linux environment:export JAVA_HOME="Absolute_Path_To_JDK1.7" and then restart the Android studio with the JAVA_HOME set correctly. May be you can set/export it in ".bashrc" or other startup script.


For others facing similar issue, check your java version first:

java -version

Update the JDK && JRE if you are running lower version based on the link above. For Ubuntu;

  • update-alternatives --display java [checking all versions available]
  • sudo apt-get install openjdk-?-jdk openjdk-?-jre [ ? == version you got from the wiki link above ]
  • sudo update-alternatives --config java [ setting the default java ]

And then if required, set the JAVA_HOME environment variable as stated above.

查看更多
登录 后发表回答