机器人的WebView的AdMob不显示 [英] android webview admob not displaying

查看:199
本文介绍了机器人的WebView的AdMob不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用谷歌增加了我的页面底部..到仿真器是正确显示添加,但在设备不
它给了我..

  6月7日至二十日:16:24.931:WARN / WebCore的(4289):第一个布局后无法得到viewWidth
六月七号至20号:16:25.101:WARN /广告(4289):无效的未知请求错误:无法确定请求类型。是您的广告单元ID是否正确?
六月七号至20号:16:25.111:信息/广告(4289):onFailedToReceiveAd(无效的谷歌广告的要求。)
六月七号至20号:16:28.957:​​WARN / PowerManagerService(175):定时器0x7-> 0x3中|为0x0
6月7日至二十日:16:28.957:​​信息/ PowerManagerService(175):7- Ulight→3 | 0
六月七号至20号:16:30.351:WARN / InputManagerService(175):窗口已经集中,忽略了聚焦增益:com.android.internal.view.IInputMethodClient$Stub$Proxy@4a43b8f8
六月七号至20号:16:45.961:WARN / PowerManagerService(175):定时器0x3->为0x1 |为0x0
六月七号至20号:16:45.961:信息/ PowerManagerService(175):Ulight 3→1 | 0
 

我无法理解是什么问题?同code是在模拟器上运行正常,但不是在装置 我的XML文件是

 < XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT机器人:ID =@ + ID / rltvLayout
    机器人:layout_height =FILL_PARENT>

    <的LinearLayout机器人:ID =@ + ID / linearLayout1
        机器人:layout_height =WRAP_CONTENT机器人:layout_width =WRAP_CONTENT
        机器人:方向=垂直>
        <的WebView机器人:ID =@ + ID / web视图机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT机器人:fitsSystemWindows =真/>

        < / LinearLayout中>
        < LinearLayout中的android:layout_width =FILL_PARENT
 机器人:ID =@ + ID / ad_layout
 机器人:layout_height =WRAP_CONTENT
 机器人:重力=底
 机器人:layout_alignParentBottom =真
 机器人:layout_alignBottom =@ + ID / home_layout>
 < / LinearLayout中>
            < / RelativeLayout的>
 

解决方案

我已经使用这个xml文件中

 < XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:广告=htt​​p://schemas.android.com/apk/lib/com.google.ads
    机器人:layout_width =FILL_PARENT机器人:ID =@ + ID / rltvLayout1
    机器人:layout_height =FILL_PARENT>
    <的LinearLayout机器人:ID =@ + ID / linearLayoutwebview
        机器人:layout_height =WRAP_CONTENT机器人:layout_width =WRAP_CONTENT
        机器人:方向=垂直>
        <的WebView机器人:ID =@ + ID / webView1
            机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT
            机器人:fitsSystemWindows =真/>
    < / LinearLayout中>
    < LinearLayout中的android:layout_width =FILL_PARENT
        机器人:ID =@ + ID / ad_layout机器人:layout_height =WRAP_CONTENT
        机器人:重力=自下而上的Andr​​oid版本:layout_alignParentBottom =真
        机器人:layout_alignBottom =@ + ID / home_layout>
        < com.google.ads.AdView机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT的广告:adUnitId =这里把ID
            广告:adSize =大旗机器人:ID =@ + ID / AD浏览报的广告:的refreshInterval =60/>

    < / LinearLayout中>
< / RelativeLayout的>
 

还有一点是,我发现
有一些变化Admob的工作在版本4.1.0
方式     1)删除attrs.xml(或者,如果你需要它自己的自定义属性,删除相关AdViews的部分)。

2)改变你的布局命名空间的的xmlns:广告=htt​​p://schemas.android.com/apk/res/com.your.packagename来的xmlns:广告=htt​​p://schemas.android .COM / APK / lib目录/ com.google.ads  查看更多...

i want to use google adds at bottom of my page.. into the emulator it properly displays the add but in device it doesn't
it gives me..

07-20 06:16:24.931: WARN/webcore(4289): Can't get the viewWidth after the first layout
07-20 06:16:25.101: WARN/Ads(4289): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?
07-20 06:16:25.111: INFO/Ads(4289): onFailedToReceiveAd(Invalid Google Ad request.)
07-20 06:16:28.957: WARN/PowerManagerService(175): Timer 0x7->0x3|0x0
07-20 06:16:28.957: INFO/PowerManagerService(175): Ulight 7->3|0
07-20 06:16:30.351: WARN/InputManagerService(175): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4a43b8f8
07-20 06:16:45.961: WARN/PowerManagerService(175): Timer 0x3->0x1|0x0
07-20 06:16:45.961: INFO/PowerManagerService(175): Ulight 3->1|0

i cant understand what is the problem? the same code is properly running on the emulator but not in device my XML file is

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:id="@+id/rltvLayout"
    android:layout_height="fill_parent">

    <LinearLayout android:id="@+id/linearLayout1"
        android:layout_height="wrap_content" android:layout_width="wrap_content"
        android:orientation="vertical">
        <WebView android:id="@+id/webView" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:fitsSystemWindows="true"/>

        </LinearLayout>
        <LinearLayout android:layout_width="fill_parent"
 android:id="@+id/ad_layout"
 android:layout_height="wrap_content"
 android:gravity="bottom"
 android:layout_alignParentBottom="true"
 android:layout_alignBottom="@+id/home_layout">
 </LinearLayout>
            </RelativeLayout>

解决方案

i've use this in xml file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/rltvLayout1"
    android:layout_height="fill_parent">
    <LinearLayout android:id="@+id/linearLayoutwebview"
        android:layout_height="wrap_content" android:layout_width="wrap_content"
        android:orientation="vertical">
        <WebView android:id="@+id/webView1"
            android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:fitsSystemWindows="true" />
    </LinearLayout>
    <LinearLayout android:layout_width="fill_parent"
        android:id="@+id/ad_layout" android:layout_height="wrap_content"
        android:gravity="bottom" android:layout_alignParentBottom="true"
        android:layout_alignBottom="@+id/home_layout">
        <com.google.ads.AdView android:layout_width="wrap_content"
            android:layout_height="wrap_content" ads:adUnitId="here put ID"
            ads:adSize="BANNER" android:id="@+id/adView" ads:refreshInterval="60" />

    </LinearLayout>
</RelativeLayout>

one more point i found is that
There are some changes to the way Admob works in version 4.1.0
1) Remove attrs.xml (or if you need it for your own custom attributes, remove the parts related to AdViews).

2) Change the namespace in your layout from xmlns:ads="http://schemas.android.com/apk/res/com.your.packagename" to xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" see more...

这篇关于机器人的WebView的AdMob不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆