AdMob广告没有显示出来

问题描述:

我得向AdMob没有出现广告的问题...AdMob广告没有显示出来

这里的logcat的:

WARN/AdMobSDK(502): Ignoring requestFreshAd() because we are requesting an ad right now already. 
INFO/AdMobSDK(502): No fill. Server replied that no ads are available (1164ms) 
INFO/AdMobSDK(502): No fill. Server replied that no ads are available (846ms) 

我试图测试模式,无需测试模式,模拟器,真正的手机等,它从来没有显示任何东西了,但我得到请求和Admob统计打印,就像它曾经工作过...

AFAIK,我做了所有的Admob Android SDK ...只有可能成为任何问题的原因,恕我直言,将是事实在我使用的标签与滚动视图,然后RelativeLayout的该广告显示布局...

这里的布局的标签样本:

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:myapp="http://schemas.android.com/apk/res/com.xxx.xxx" 
    android:id="@+id/tababout" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#FF000000"> 
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#FF000000" 
    android:padding="10px"> 

    <ImageView 
     android:id="@+id/label_img" 
     android:src="@drawable/about_header" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
     android:scaleType="centerInside" /> 

    <TextView android:id="@+id/label_know_more_desc" 
     style="@style/Desc" 
     android:layout_below="@id/label_img" 
     android:text="@string/tab_about_know_more_desc" /> 

    <Button android:id="@+id/bt_know_more" 
     style="@style/Button" 
     android:gravity="center_vertical|center_horizontal" 
     android:layout_below="@id/label_know_more_desc" 
     android:text="@string/tab_about_know_more_bt" /> 

    <com.admob.android.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" /> 
</RelativeLayout> 
</ScrollView> 

而这里的main.xml中,而不是我认为你需要它:

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@android:id/tabhost" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#FF000000"> 

<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <TabWidget 
     android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" /> 

    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="#FF000000" 
     android:paddingTop="5px"> 

    </FrameLayout> 
</LinearLayout> 
</TabHost> 

我在Admob ads will not display when placed inside a tabview阅读,这个问题可能是10px的填充,我扔在,但即使我禁用,这是行不通的。

我甚至尝试移动的xmlns:MYAPP到RelativeLayout的,但显然没有任何改变....

而且,我做了我的第一个活广告请求超过24个小时前...

编辑

好了,现在我就在某个地方,我已经成功地获得测试广告显示出来(我setTestDevices是在OnCreate代码太晚了,我把它上升到第行),但不是真正的...我错过了什么?我明明注释掉setTestDevices线和没有广告显示

EDIT 2

嘛,我加了两个内部广告(我已经启用了内部广告,但没有内部广告设置),突然广告开始在我的应用中显示(不仅仅是内部广告)。

我想一切都完成了它的工作?! :)

谢谢大家!

您不是将广告放置在RelativeLayout中(它们需要layout_above或layout_below或其他来指定放置它们的位置)。

还有一个admob的最小尺寸,你可能想要确保你匹配,我认为它至少是48dip的高度,不知道水平是什么。

最后,我不知道你在哪里试图放置广告,但它可能会在你的主框架布局更有意义,我在我的应用程序的底部填充了一个填充,视图。

编辑:同样如果您的应用程序公开检查广告收入。 Android 2.3版允许广告隐藏在视图后方,并仍然注册点击。在我的广告甚至被任何人看到之前,我实际上已经做出了最初的1美元。

+0

以后将检查今天让你知道如何去。 ;) – 2010-12-29 11:55:13

+0

好的,所以我采纳了你的建议,并将广告块放在主布局上,如果我将它的背景颜色更改为白色,并设置固定高度,我可以看到它(白色块),但没有显示内部该块... – 2010-12-29 21:55:09

AdMob广告不会显示的另一个原因是您尚未声明AdActivity,它会在点击广告时显示广告。如果没有在AndroidManifest.xml中声明AdActivity,我看不到广告。随着它宣布,广告出现。

... ...的AndroidManifest.xml

<!-- AdMob --> 
<activity android:name="com.google.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation"/>