Showing posts with label admob. Show all posts
Showing posts with label admob. Show all posts

Saturday, September 19, 2015

Required XML attribute “adSize” was missing

<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"/>
basically, add this line in the ads xml
xmlns:ads="http://schemas.android.com/apk/res-auto"

Device Test ID for Admob

If you are running admob ads on an emulator then there is no ID. just use the AdManager method and set it to TEST_EMULATOR like the logcat says. If you run on an actual device with usb debugging and watch the logcat, the ID will appear in there. You can filter the logs by using "device" or "adRequest" (Case Sensitive) as the filter. After filtering using the above mentioned terms "adRequest", you'll find a line -
12-19 17:48:25.615: I/Ads(2132): To get test ads on this device, call adRequest.addTestDevice("D9XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");