在集成AdMob时未找到资源异常

时间:2013-04-03 03:53:53

标签: android admob

Android 2.3.3

我已按照this教程中的步骤进行操作。当我在我的设备(移动设备)中运行应用程序时,广告就会显示出来。这里没问题。但是当我尝试在我的日食中查看活动时,我得到一个带有NullPointerException的空白屏幕。我拍了截图。请参考它。

enter image description here

然后,我点击了链接,在例外的“详细信息”(SourceFile:670)中给出,我得到以下详细信息..

enter image description here

我点击了Add Source,并浏览了我的application-> libs文件夹中的jar文件。然后我得到以下内容......

enter image description here

以下是我使用过的xml和java代码......

XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:background="#000000"
        android:orientation="vertical" >

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



        <TextView
            android:id="@+id/txtViewPrevious"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:gravity="right"
            android:height="25dp"
            android:singleLine="true"
            android:text=""
            android:textSize="16sp" />

.....
.....

爪哇

private AdView adView;
adView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest();
        adView.loadAd(adRequest);

利布斯

enter image description here

我如何摆脱这些例外?

提前致谢...

2 个答案:

答案 0 :(得分:1)

这种情况发生了。这是正常的。 Eclipse有时无法显示自定义视图(实际上大部分时间都是如此)。

答案 1 :(得分:0)

Download最新的SDK。根据{{​​3}},这已在v6.3.0中修复。