There are so question like that but it's not duplicate
because i have already used xmlns:ads="http://schemas.android.com/apk/res-auto" and i have done code mostly in java
I want to use google play service for ads
I have used below java code
com.google.android.gms.ads.AdView adView = (com.google.android.gms.ads.AdView) activity.findViewById(R.id.adview);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(activity.getString(R.string.admob_id));
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
and following xml code
<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"
/>
but i am getting error in banner is like
Requred XML attribute 'adsize' was missing
Change the namespace to
Ad.xml
NOTE :
Use this Namespace for new SDK
Try add "ads:adSize" to XML like below:
Remove "adView.setAdSize(AdSize.SMART_BANNER);" from your java file.
Refer below:
Here is the XML layout
And here is your java file
Refer the example here https://github.com/googleads/googleads-mobile-android-examples/tree/master/admob/banner-xml