Chris D
Chris D

Reputation: 820

Unable to Add AdMob SDK to Android Project in Android Studio

I'm trying to use the latest version of the Admob SDK that is built into Google Play Services in my project using Android Studio but it is not recognizing

activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

Specifically the ads.AdActivity part. I have the following in my build.gradle:

dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.0.30'}

I can't seem to figure out what is causing it to not recognize the ads.AdActivity so I can begin to add the ads to my app. Any ideas?

EDIT

Also the admob documentation states:

Make sure you have the latest copy of the Android SDK and that you're compiling against at least Android v3.2 (set target in project.properties to android-13).

The Google Mobile Ads SDK for Android requires a run-time of Android 2.3 or later (set android:minSdkVersion to at least 9 in your AndroidManifest.xml). This means you can develop with the latest version of the Android SDK and your app will still run on an earlier Android version (2.3 minimum).

I don't see a way to set project.properties in android studio but I have the following settings in my build.gradle:

android {
compileSdkVersion 19
buildToolsVersion "17.0.0"

defaultConfig {
    minSdkVersion 13
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}

Upvotes: 1

Views: 2099

Answers (1)

Barışcan Kayaoğlu
Barışcan Kayaoğlu

Reputation: 1304

You probably need to increase your API level. I recall it has a minimum API 13 or something.

Upvotes: 1

Related Questions