Required XML attribute "adSize" was missing?

1) Use the XML namespace " http://schemas.android.com/ apk/res-auto ". Using XML <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 = "AD_UNIT_ID" ads:adSize = "BANNER" /> Programatically AdView adView = new AdView ( getActivity ()); adView . setAdUnitId ( "YourId" ); adView . setAdSize ( AdSize . BANNER ); final LinearLayout adLinLay = ( LinearLayout ) view . findViewById ( R . id . linear ); adLinLay . addView ( adView ); final AdRequest . Builder adReq = new AdRequest . Builder (); final AdRequest adRequest = adReq . build (); adView . loadAd ( adRequest );