-2

I am trying to add a viewpager inside a fragment but when I wrote following:

 <android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

This produced following exception while rendering:

"Exception raised during rendering: android/support/v4/view/ViewPager : Unsupported major.minor version 51.0"

Can anyone tell why this is happening and what should I do to solve that?

balaji koduri
  • 1,321
  • 9
  • 25

2 Answers2

0

download JDK 7, and change the default JDK from 1.6 to 1.7

3.1 Download and install openjdk-7-jdk

$ sudo apt-get install openjdk-7-jdk openjdk-7-jre

3.2 Change the default Java to 1.7 (Working on Debian like system only).

$ sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java).

Selection

  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode

  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode

  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

Press enter to keep the current choice[*], or type selection number: 2 update-alternatives: using

/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 
to provide /usr/bin/java 

(java) in manual mode

$ java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1~deb7u1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

for more info see below link:-

http://www.mkyong.com/java/java-unsupported-major-minor-version-51-0/

duggu
  • 37,851
  • 12
  • 116
  • 113
0

This might help you:

Go to Project > Properties > Java Compiler.

Enable Project specific settings, and change Compiler Compliance Level to 1.6 or lower.

Test your app again.

max59
  • 606
  • 1
  • 7
  • 16