2012-02-17 57 views
1

我的广告没有显示,我试图将它们添加到我的webview应用程序中。这是主要的.xml代码:Admob没有显示在webview中

<?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="wrap_content" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <com.google.ads.AdView android:id="@+id/adView" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         ads:adUnitId="a14f3ed10a5e4eb" 
         ads:adSize="BANNER" 
         ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" 
         ads:loadAdOnCreate="true"/> 
<WebView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/webview" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" 
    /> 

</LinearLayout> 

任何建议?

+0

的AdMob是在模拟器上显示,但不是我的设备上。 WTF?!?! – 2012-02-17 23:07:20

+0

尝试将一些日志文件添加到admob类并查看是否遇到任何问题。 – 2012-02-17 23:30:44

+1

在设备上进行调试时,您会得到什么logcat输出?也许有一句话说“广告请求成功了,但没有广告因缺乏广告而返回”。通过说'ads:testDevices =“TEST_EMULATOR,TEST_DEVICE_ID”',这意味着模拟器正在获得测试广告。您必须将TEST_DEVICE_ID替换为您的实际测试设备ID才能在您的设备上获取测试广告。在设备上进行调试时,也可以在logcat输出中找到此标识(“要在此设备上获取测试广告,请添加AdRequest.addTestDevice(”your_device_id“);”)。 – 2012-02-17 23:36:52

回答

0

你必须给特定ID给addMob。只需在GoogleAddMob网站上查看默认示例,然后即可。

0

通过Eclipse使用调试模式,并从developer.android.com启动和Sample Ad应用程序。在LogCat中使用Ctrl + F搜索“要得到测试”,你会在那里看到id。

或检查有详细此链接如何: Get ad id how to