The ad size and ad unit ID must be set before loadAd when set programmatically
Create it programatically View adContainer = findViewById(R.id.adMobView); AdView mAdView = new AdView(context); mAdView.setAdSize(AdSize.BANNER); mAdView.setAdUnitId(YOUR_BANNER_ID); ((RelativeLayout)adContainer).addView(mAdView); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); And in your xml file <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent”> <RelativeLayout android:id=”@+id/adMobView” android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_alignParentBottom=”true”/> </RelativeLayout> EDIT The best practice for banners, is two show one banner per view (one unitId), if you want … Read more