Get Started in Android Studio

This guide is intended for publishers who want to use AdMob to monetize an Android app that's built with Firebase. If you don't plan to include Firebase in your app, see the standalone AdMob version of this guide instead.

The first step toward displaying AdMob ads and earning revenue is to import and initialize the Google Mobile Ads SDK. This guide walks you through that step. Once it's done, you can choose an ad format (such as native or rewarded video) and get a detailed set of steps for implementing it.


  1. Sign up for an AdMob account and register an app.

  2. Connect your app to a Firebase project, which includes configuring your app for Firebase, adding Google's Maven repository, and downloading the Firebase SDK for Android.

Import the Mobile Ads SDK

  1. Add the dependency for the Mobile Ads Android library to your module (app-level) Gradle file (usually app/build.gradle):

    implementation ''
  2. Save the file and perform a Gradle sync.

The SDK is distributed as part of the Google Repository, so you may see a message from Android Studio asking you to install it. If so, just agree to the download and Android Studio will take care of the rest.

Update your AndroidManifest.xml

Add your AdMob App ID to your app's AndroidManifest.xml file by adding the <meta-data> tag shown below. You can find your App ID in the AdMob UI. For android:value insert your own AdMob App ID in quotes, as shown below.

        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->

Initialize the SDK

Before loading ads, have your app initialize the Mobile Ads SDK by calling MobileAds.initialize() with your AdMob App ID. This only needs to be done once, ideally at app launch. You can find your app's App ID in the AdMob User Interface.

Here's an example of how to call the initialize() method in an Activity:


protected void onCreate(Bundle savedInstanceState) {
    // ...
    // Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713
    MobileAds.initialize(this, "YOUR_ADMOB_APP_ID");


override fun onCreate(savedInstanceState: Bundle?) {
    // ...
    // Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713
    MobileAds.initialize(this, "YOUR_ADMOB_APP_ID")

If you haven't created an AdMob account and registered an app yet, there's no better time than now. If you're just experimenting with the SDK in a Hello World app, though, you can use this App ID to call the initialize method: ca-app-pub-3940256099942544~3347511713.

Choose an ad format

The Mobile Ads SDK is now imported and initialized, and you're ready to implement an ad. AdMob offers a number of different ad formats, so you can choose the one that best fits your app's user experience.

Banner ads are rectangular image or text ads that occupy a spot within an app's layout. They stay on screen while users are interacting with the app, and can refresh automatically after a certain period of time. If you're new to mobile advertising, they're a great place to start.

Implement a Banner


Interstitials are full-screen ads that cover the interface of an app until closed by the user. They're best used at natural pauses in the flow of an app's execution, such as in between levels of a game or just after completing a task.

Implement an Interstitial


Native is a component-based ad format that gives you the freedom to customize the way assets like headlines and calls to action are presented in their apps. By choosing fonts, colors, and other details for yourself, you can create natural, unobtrusive ad presentations that can add to a rich user experience.

Native is currently in a closed beta with a limited group of publishers.

Implement Native Ads Advanced

Rewarded Video

Rewarded (or "reward-based") video ads are full screen video ads that users have the option of watching in full in exchange for in-app rewards.

Implement Rewarded Video