2015-04-14 5 views
0

В моем макете xml отсутствует атрибут XML adSize. вот мой макет xml Может ли кто-нибудь помочь мне разобраться, что я делаю неправильно здесь. Я пробовал методы severel, описанные для этого типа вопросов, но не повезло.Android - AdView отсутствует необходимый атрибут XML adSize при попытке добавить admob

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="16dp" 
    android:paddingRight="16dp" 
    android:orientation="vertical" > 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:baselineAligned="false" 
    android:layout_weight="1"> 
    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:orientation="vertical" > 
     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:text="@string/close" 
      android:onClick="dbcheck2"/> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:orientation="vertical" > 
     <Button 
      android:id="@+id/button2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:onClick="startShowMeaningService" 
      android:text="@string/startapp" /> 
    </LinearLayout> 
</LinearLayout> 
<com.google.android.gms.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_alignParentBottom="true" 
     ads:adSize="BANNER" 
     ads:adUnitId="@string/banner_ad_unit_id"> 
    </com.google.android.gms.ads.AdView> 
</LinearLayout> 
+0

возможно дубликат [AdMob в андроиде "AdView отсутствует необходимый атрибут XML 'adSize'"] (http://stackoverflow.com/questions/7185335/admob -in-android-adview-missing-required-xml-attribute-adsize) – Rajesh

+0

проект чистой сборки. – Harry

+0

@ Харри, я все же не работал – Channa

ответ

2

вы пропустили имена

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

, но в этом уроке они просят использовать это пространство имен xmlns: ads = "http://schemas.android.com/apk/res-auto", я попробовал и ваш, но все еще не работает – Channa

+0

@Чанн новый требует этого xmlns: ads = "http://schemas.android.com/apk/res-auto" – Fahim

+0

Спасибо, я перезапустил все и теперь работает – Channa

Смежные вопросы