Eclipse Graphical Layout unable to display adView

这一生的挚爱 提交于 2019-12-05 01:45:23

问题


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.


回答1:


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




回答2:


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!




回答3:


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:



来源:https://stackoverflow.com/questions/25331730/eclipse-graphical-layout-unable-to-display-adview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!