Android studio &引用;adSize";不见了

Android studio &引用;adSize";不见了,android-studio,admob,google-play-services,Android Studio,Admob,Google Play Services,我正在尝试使用Admob在我的应用程序中放置广告 然而,它一直在说“缺少必需的XML属性”adSize“即使该属性在我的XML文件中 <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="fill_parent" android:layout_height="wrap_content" ads:adUnitId="MY UNIT ID"

我正在尝试使用Admob在我的应用程序中放置广告

然而,它一直在说“缺少必需的XML属性”adSize“即使该属性在我的XML文件中

    <com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    ads:adUnitId="MY UNIT ID"
    ads:adSize="BANNER"
    android:layout_alignParentStart="true"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true" />

有人知道为什么会这样吗


干杯。

确保您的版面有,
xmlns:ads=”http://schemas.android.com/apk/res-auto“
属性,这也是为什么您将
布局\u宽度
作为
填充\u父项
而不是
包装\u内容
,所以请尝试更改该属性。”

看看你是否还没有。主要有
activity\u main.xml

您也可以使用整个XML布局文件来解决这个问题。您可以删除不想发布的内容

或者,尝试将声明更改为以下内容,从:



人们还建议重新启动IDE

您的布局有xmlns:ads=“”?是布局宽度造成了问题。谢谢你的帮助。
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="YOUR_AD_UNIT_ID"
ads:adSize="BANNER"/>