Installing Google AdMob into Android Apps

Previously I wrote on why ads are needed to help maintaining an app. Read the article here

---This is quite an old article. You may find the latest supporting AdMob 6.x in here ---

This is quite a long tutorial, there are 3 major steps involved. The experiment is done using Windows 7, Eclipse Helios and AdMob SDK 4.1.0 (which currently is the latest-during time of writing).

STEP 1: Get the ads from

To display the AdMob ads in your Android mobile apps, you need to register first at the . After completing the registration, login and Add Site/App. Refer to Figure 1.


Figure 1

Choose the desired platform and fill in the details (as in Figure 2). Just put http:// in the Android Package URL if your app is not published in the market yet. And click Continue.

ScreenHunter_16 May. 16 08.35

Figure 2

Download the AdMob Android SDK, and save the zip file in your machine. Make sure to extract the file and save it to your hard disk (anywhere is possible).

ScreenHunter_17 May. 16 08.36

Figure 3

STEP 2: Install the AdMob SDK into your Android project.

The most important file in the AdMob Android SDK that you download is GoogleAdMobAdsSdk-4.1.0.jar . Currently it’s in version 4.1.0 .

ScreenHunter_18 May. 16 08.40

Figure 4

Go to your project folder (in Eclipse), and right click to your project (Figure 5). Choose Properties.


Figure 5

Click the Java Build Path on your left. Choose the Libraries in the tab, and click Add External JARs. Locate the JAR file (GoogleAdMobAdsSdk-4.1.0.jar). And click OK.


Figure 6


Figure 7


Figure 8

STEP 3: The codes to display ads in your app.

Add some additional activity and permissions in the manifest.xml file.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Calc"
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<activity android:name=""

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-sdk android:minSdkVersion="4" />


Create attr.xml file in the res/values 



Related links

  1. Official Documentation (which is not updated timely) -
  2. Official Discussion (AdMob SDK 4.0.10) -
  3. A very good tutorial for AdMob SDK 4.0.4 -

Popular Posts