How To Implement Admob Banner Ads in Android Studio

 Step 1: First of all create new Project in Android Studio then open build.gradle (Module App) and add Admob SDK dependency 

implementation 'com.google.android.gms:play-services-ads:19.6.0'

Now open your Manifest.xml and Add meta data and internet permission 

inside manifest tag

 <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

inside application tag

 <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>


Step 2: Now open your activity xml and add the Banner Ads Xml 

 <com.google.android.gms.ads.AdView
        android:id="@+id/banner"
        android:layout_alignParentBottom="true"
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
    </com.google.android.gms.ads.AdView> 

Step 3: Let's write java code , now open layout class.java and write (Copy paste) these codes

first add AdView variable inside the class

AdView adView;

then add these code in onCreate() method

MobileAds.initialize(this, new OnInitializationCompleteListener() {
            @Override
            public void onInitializationComplete(InitializationStatus initializationStatus) {
            }
        });


        adView = findViewById(R.id.banner);
        AdRequest adRequest = new AdRequest.Builder().build();
        adView.loadAd(adRequest);
        AdView adView = new AdView(this);
        adView.setAdSize(AdSize.SMART_BANNER);


        adView.setAdListener(new AdListener(){


            @Override
            public void onAdFailedToLoad(LoadAdError loadAdError) {

                AdRequest adRequest = new AdRequest.Builder().build();
                adView.loadAd(adRequest);

                super.onAdFailedToLoad(loadAdError);
            }
        });


Finally you have successfully Implement Banners Ad's in your Android App