kasai
kasai

Reputation: 145

Eclipse Graphical Layout unable to display adView

I updated from Eclipse Helios to Eclipse Juno, updated Android SDK tools to v23, and Google Play lib 4.4.

Since them i am unable to view XML layouts in eclipse Graphical Layout Window. I get following error.

Exception raised during rendering: com/google/android/gms/ads/AdView : Unsupported major.minor version 51.0
Exception details are logged in Window > Show View > Error Log

Error Log

Could not create the view: org.eclipse.pde.runtime.LogView

The error only shows when i add Google AdView XML in Layout, other wise Graphical Layout works fine.

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:ads="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent" >

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="xxxxxxxxxxxxxxxxxxxxxxxx" />

</RelativeLayout>

Any help would be appreciated.

Upvotes: 5

Views: 2035

Answers (3)

Nick
Nick

Reputation: 1423

I bet you are using Java JDK 1.6.

You have to go to Eclipse -> Window -> Preferences -> Java -> Compiler and set compiler to 1.7. Ofcourse you must have Java JDK 1.7 installed. If you don't, install it and the problem will dissappear.

At least that was the case with me.

I hope it helps!

Upvotes: 1

Plugie
Plugie

Reputation: 1307

I still have a problem even change API to 19 based on a zhangxaochen's answer

I solve the problem after i Install JDK 1.7.

Java compiler in Windows -> Preferences -> Java -> compiler still use 1.6

Upvotes: 2

zhangxaochen
zhangxaochen

Reputation: 33997

I solved the problem just now by change the android version to use when rendering layouts to API 19, by default it's API 20:

enter image description here

Upvotes: 0

Related Questions