[英]Android Studio AdMob error cannot resolve symbol @integer/google_play_services_version"/>
I am trying to get AdMob into my app but this error comes up and I am not sure how to fix it. 我试图让AdMob进入我的应用程序,但是这个错误出现了,我不知道如何解决它。
<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 cannot resolve symbol AdActivity. 有错误说无法解析符号AdActivity。 I'm not sure what's causing these issues, and would appreciate some help.
我不确定是什么导致了这些问题,并希望得到一些帮助。
build.gradle 的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'
}
You need to add a line in your build.gradle to compile Google Play Services, take a look at the documentation here 您需要在build.gradle中添加一行来编译Google Play服务,请查看此处的文档
So your dependencies should be something like this if you're using the latest version of Google Play Services: 因此,如果您使用的是最新版本的Google Play服务,那么您的依赖关系应该是这样的:
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'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.