Android Admob未显示在webview中
我的广告没有显示,我正在尝试将它们添加到我的webview应用程序中。这是main.xml代码:Android Admob未显示在webview中,android,layout,webview,admob,Android,Layout,Webview,Admob,我的广告没有显示,我正在尝试将它们添加到我的webview应用程序中。这是main.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:la
<?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>
任何建议???您必须向addMob提供特定ID。只需查看GoogleAddMob站点上的默认示例,然后按照该示例进行操作。通过Eclipse使用调试模式,并从developer.android.com启动示例广告应用程序。在LogCat中,使用Ctrl+F搜索“获取测试”,您将在那里看到id 或查看此链接,了解如何:
adMob会显示在模拟器上,但不会显示在我的设备上。世界跆拳道联盟?!?!尝试向admob类中添加一些日志文件,查看是否遇到任何问题。在设备上调试时,您会得到什么logcat输出?也许其中有一句话是“广告请求成功,但由于缺乏库存,没有广告返回。”通过说
ads:testDevices=“TEST\u EMULATOR,TEST\u DEVICE\u ID”
,这意味着仿真器正在获得测试广告。您必须用实际的测试设备ID替换TEST\u DEVICE\u ID才能在设备上获得测试广告。在设备上调试时,也可以在logcat输出中找到此id(“要在此设备上获取测试广告,请添加AdRequest.addTestDevice(“您的设备id”)”)。eric您是对的!现在它工作得很好