1

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"
}
Chris D
  • 810
  • 1
  • 9
  • 21
  • What's the symptom? What do you mean when you say it's not recognizing ? – Scott Barta Jan 14 '14 at 17:23
  • for Admob Ads you have to have the following in your manifest: I get two errors on com.google.android.gms.ads.AdActivity stating "cannot resolve symbol ads" and the same thing for AdActivity. – Chris D Jan 14 '14 at 17:38
  • 1
    Is it this? http://stackoverflow.com/questions/21100688/android-studio-0-4-2-suddenly-cannot-resolve-symbols/21100896#21100896 – Scott Barta Jan 14 '14 at 17:40
  • Thank you so much! Do we know what causes that? – Chris D Jan 14 '14 at 18:24
  • It's bug https://code.google.com/p/android/issues/detail?id=64508. I'm going to mark this question as a duplicate of the other. – Scott Barta Jan 14 '14 at 18:26
  • Answer can be found here ..... http://stackoverflow.com/a/20509508/619673 – deadfish May 17 '14 at 20:46

1 Answers1

1

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

Barışcan Kayaoğlu
  • 1,294
  • 3
  • 14
  • 35
  • Nope, that is not the cause. I was set to 10, tried 13 and 19 and I'm still having the same issue. – Chris D Jan 14 '14 at 13:46
  • You changed your minimum sdk version on your manifest right? Try to compile with higher sdk as well. I'm pretty sure some of those configuration values in android:configChanges need some minimum sdk higher then the common ones. – Barışcan Kayaoğlu Jan 14 '14 at 13:52
  • So I don't believe its related to the API levels. – Chris D Jan 14 '14 at 14:12
  • Did you add GoogleAdMobAdsSdk.jar to your project? – Barışcan Kayaoğlu Jan 14 '14 at 14:17
  • 1
    No, according to the documentation version 4.0 is now offered through Google Play Services. See: https://developers.google.com/mobile-ads-sdk/download?hl=en_US – Chris D Jan 14 '14 at 14:41
  • Yes but then you either need google-play-services.jar or you need to compile with the google sdk – Barışcan Kayaoğlu Jan 14 '14 at 15:19
  • Read the directions for adding Google Play Services for Android Studio, you do not have to add the jar file. You add it via build.gradle. https://developer.android.com/google/play-services/setup.html – Chris D Jan 14 '14 at 17:40