0

I'm using Eclipse 4.3.2 on Mac (Yosemite v 10.10) and I'm developing for Android OS. A week ago I'm occurring on this error

"android/support/v4/view/ViewPager : Unsupported major.minor version 51.0"

using Android V4 Support ViewPager.

I just googled this problem and I have JDK version 1.7.0_71 installed under "Properties->Java->Installed JREs" and JDK 1.7 under "Properties->Java->Compiler"

I don't really know what is the problem cause all the JDK seems to be right. Someone can help me? Thanks

UPDATE: The result of "java -version" command is

java version "1.7.0_71" Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

UPDATE 2: I've just update the JDK and JRE to 1.8 but still not working.

1 Answers1

0

java.lang.UnsupportedClassVersionError happens when using a higher JDK during compile time and a lower JRE during runtime

I think you need to change the java version in the project specific settings too.

Project -> Properties -> Java Compiler

Enable project specific settings (checked) Uncheck "use Compliance from execution environment" and select the desired "compiler compliance level

EDIT

If you are using maven to build your project, make sure you have configured it properly

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> You might also want to do a Project->Clean in eclipse or even better manually delete the output folder from your project root.

Another this is that the old Android development tools only support JDK 6. Are you sure you are using one of the latest versions of the Android tools that support JDK 7?

Katerina A.
  • 1,268
  • 10
  • 24
  • Thank Katerina for your reply. I modify the Java Compiler ("use Compliance from execution environment" was just uncheck) and I select 1.8. Next I java the project Build Path to Android API 21 and change the "API look" (the last button with the Android logo) on the layout design to Android 21 but the error remains (Parsing Data for android-21 failed Unsupported major.minor version 51.0). – Mattia Scagno Nov 28 '14 at 14:39
  • I added some more hints. Hope this helps. – Katerina A. Dec 01 '14 at 08:42