Required XML attribute "adSize" was missing
I have same problem.
Solution for me:
xmlns:ads=""
changed to
xmlns:ads="http://schemas.android.com/apk/res-auto"
Here is a weird answer. I just restarted my eclipse and it stared working. This might help some one.
Just restart eclipse, android studio or IntelliJ IDE
Try changing your declaration this way:
<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"/>
---- EDIT ----
You can also try to do it programmatically. Simply, instead of an AdView
layout item, define a LinearLayout
and by code do something like this:
final AdView adView = new AdView(getActivity());
adView.setAdUnitId("YourId");
adView.setAdSize(AdSize.BANNER);
final LinearLayout adLinLay = (LinearLayout) view.findViewById(R.id.your_defined_linearlayout);
adLinLay.addView(adView);
final AdRequest.Builder adReq = new AdRequest.Builder();
final AdRequest adRequest = adReq.build();
adView.loadAd(adRequest);