Android Studio error AdMob cannot resolve the @ integer / google_play_services_version "/"> symbol
I'm trying to load AdMob into my app, but this error comes up and I'm not sure how to fix it.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android.configChanges="keyboard|keyboardHidden|
orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>"
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout
|uiMode|screenSize|smallestScreenSize" />"
<activity android:name=".SettingsPage"
android:label="Settings"
android:theme="@style/AppTheme"/>
</application>
Also, the line
<activity android:name="com.google.android.gms.ads.AdActivity"
has an error saying it cannot resolve the AdActivity symbol. I'm not sure what caused these problems and would be happy to help.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.name.application"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), '
proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
+3
source to share
1 answer
You need to add a line to build.gradle to compile google play services, take a look at the documentation here
Thus, your dependencies should be as if you were using the latest version of Google Play Services:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
+4
source to share