简体   繁体   中英

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.

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

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!

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 :

在此输入图像描述

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