Admob的“以下类不能被实例化: - com.google.ads.AdView”Android的XML问题 [英] Admob “The following classes could not be instantiated: - com.google.ads.AdView” Android XML Issue

查看:143
本文介绍了Admob的“以下类不能被实例化: - com.google.ads.AdView”Android的XML问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着让谷歌的AdMob的SDK集成到writen在XML Android应用程序上展示广告。是的,我已经确信,AdMob的罐子是为了和出口在构建路径检查!

我知道有其他的开放问题,但没有一个答案解决了我的问题!即时得到任何错误,我project.properties设定目标19,我的表现有这样的:

 <活动机器人:名称=com.google.ads.AdActivity
           android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
 

和我会后我的整个主布局页面 请帮我家伙!

 < RelativeLayout的的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
的xmlns:工具=htt​​p://schemas.android.com/tool​​s
的xmlns:广告=htt​​p://schemas.android.com/apk/lib/com.google.ads
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:后台=#000000
机器人:paddingBottom会=@扪/ activity_vertical_margin
机器人:paddingRight =@扪/ activity_horizo​​ntal_margin
机器人:paddingTop =@扪/ activity_vertical_margin
工具:上下文=MainActivity。>

<的TextView
    机器人:ID =@ + ID / textView1
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_alignLeft =@ + ID / imageView1
    机器人:layout_centerVertical =真
    机器人:重力=中心
    机器人:文本=@字符串/ text_mainmenu
    机器人:textAppearance =机器人:ATTR / textAppearanceLarge
    机器人:文字颜色=#FFFFFF/>
< com.google.ads.AdView
    机器人:ID =@ + ID / AD浏览报
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    广告:adUnitId =[MYIDHERE]
    广告:adSize =大旗
    广告:testDevices =TEST_EMULATOR,TEST_DEVICE_ID
    广告:loadAdOnCreate =真/>
< / RelativeLayout的>
 

解决方案

我有同样的问题。还有与当你渲染布局在Eclipse中为Android-19(奇巧)的图形布局的一些问题。你不能改变例如属性窗口中的项目。

切换到Android-18图形布局(绿色的Andr​​oid右上)解决了这个问题对我来说。

Im trying to get the google admob sdk integrated to display ads in an android application writen in xml. Yes I have already made sure that admob jar is checked in order and export under build path!

I realize there are other open questions but none of the answers solved my issue! Im getting no errors, my project.properties is set to target 19 and my manifest has this:

 <activity android:name="com.google.ads.AdActivity"
           android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

and I will post my entire main layout page Please help me guys!

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/imageView1"
    android:layout_centerVertical="true"
    android:gravity="center"
    android:text="@string/text_mainmenu"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#FFFFFF" />
<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    ads:adUnitId="[MYIDHERE]"
    ads:adSize="BANNER"
    ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
    ads:loadAdOnCreate="true" />
</RelativeLayout>

解决方案

I had the same issue. There are some issues with the Graphical Layout when you are rendering layouts in Eclipse for Android-19 (KitKat). You cannot change items in the Properties window for example.

Switching to Android-18 in Graphical Layout (green Android top-right) solved the problem for me.

这篇关于Admob的“以下类不能被实例化: - com.google.ads.AdView”Android的XML问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆