Search

How to add admob banner ads in app with android studio

World short learning tutorial website
This post i will showing how to add admob Banner ads in app with android studio,
I will show you with some pictuer so let's Start

#1 Create a (Empty project) project to the android studio,
#2 Wait for your project to be build.
Next Step !---
#follow My Example Screen Shot#
#3 go to your project gradle:app file
Cpoy this code below 

compile 'com.google.android.gms:play-services-ads:11.8.0'
Latest Version is here https://developers.google.com/android/guides/setup
Paste into the dependencies {Paste like this pictuer okke ;-_)}
after Peasting  Click Sync Now and Connect to the internet [ like the Screen Shot below ] 
Next Step !---
#4 Then open AndroidManifest.xml file[follow pictuer below]
Open This file Copy this code below
<uses-permission android:name="android.permission.INTERNET" />
And Paste inside the AndroidManifest.xml file
[follow the pictuer]
Next Step !---
#5 Go to your activity_main.xml file  [follow the pictuer]
Then copy below the code & Paste inside of the activity_main.xml file [follow the pictuer]
<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"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:visibility="visible"
        app:adSize="BANNER"
        app:adUnitId="ca-app-pub- your ADmob code">
</com.google.android.gms.ads.AdView>

Next Step !---
#6 open MainActivity.java file in you will find in this location
Open it Copy this code and Paste into MainActivity.java file

public class MainActivity extends AppCompatActivity {

    private AdView banner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

/////////Google Adds///->
        banner = findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        banner.loadAd(adRequest);
        /////////Google Adds///-> END
}}

Next Step !---
#7 all most done ;
Now follow this Step build your app now
then install your app to your android mobile then you can see your Banner Ads is showing inside the app 
you will find you image in this link 
YourAppname\app\build\outputs\apk\debug
Note: i hope you like this tutorial i have a tutorial in this think so This is the think you can get on youtube from this link