简体   繁体   中英

android/support/v4/view/ViewPager : Unsupported major.minor version 51.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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM