2013-04-03 35 views
1

Android 2.3.3集成AdMob时未发现资源异常

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

enter image description here

然后,我点击了链接,在异常的 “细节” 给出(的SourceFile:670),我得到以下细节..

enter image description here

我已经点击在Add Source上,浏览到我的应用程序 - > 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" /> 

..... 
..... 

的Java

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

Libs

enter image description here

我该如何摆脱这些例外?

在此先感谢...

回答

1

出现这种情况。这是正常的。 Eclipse有时不能显示自定义视图(实际上大部分时间)。