I want to add admob to my project and have followed the instructions from the documentation but I'm getting an error:
Cannot find symbol '@integer/google_play_services_version
inside the AndroidManifest.xml. I've looked inside the sdk directory and google_play_services version 4.0.30 is installed. Here's my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '19.0.0'
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/libGoogleAnalyticsServices.jar')
compile 'com.google.android.gms:play-services:4.0.30'
}
After adding it, I've synced the project with gradle. I also have the required entry in AndroidManifest.xml which gives me the error
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
The official docs say that for android studio we don't need to include the library but I don't understand why it doesn't find it.
Edit: I finally solved it. The problem was that I was using the wrong sdk. Android studio ships with its own SDK and that was set as default in the IDE.
android-studio\\sdk to android-sdk. If you don't know how, here's how.build.gradle corresponds to your new sdk's version.You must have Google Repository installed in order to use Google Play Services in Android Studio.
If not Installed it from SDK Manager > Extras.
After Installation your library should be located on path
$SDK_DIR\extras\google\m2repository\com\google\android\gms\play-services
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With