Android的AdView中得到错误 [英] Android Adview getting error

查看:309
本文介绍了Android的AdView中得到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

放置的AdView广告时,我得到这些错误。

I get these errors when placing adview ad.


  1. 错误:错误的解析XML:绑定preFIX
    < com.google.android.gms.ads.AdView结果
    机器人:ID =@ + ID / AD浏览机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT广告:adSize时=大旗
    广告:adUnitId设置=CA-APP-酒馆2338373260分之2852987101120590/>

错误:AdView中不能得到解决或不是场
的AdView的AdView =(的AdView)this.findViewById(R.id.adView);
AdRequest中AdRequest中=新AdRequest.Builder()建立()。
adView.loadAd(AdRequest中);

error: adView cannot be resolved or is not a field AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest);

在哪里的问题?请帮忙。我得到这两个错误。

where is problem? please help. i get those two errors.

推荐答案

添加此行的xml文件

xmlns:ads="http://schemas.android.com/apk/res-auto"

所以,例如

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/mainLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/ad_unit_id"/>
</RelativeLayout>

这篇关于Android的AdView中得到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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