簡體   English   中英

Android Studio AdMob錯誤無法解析符號@ integer / google_play_services_version“/>

[英]Android Studio AdMob error cannot resolve symbol @integer/google_play_services_version"/>

我試圖讓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>

還有,行

    <activity android:name="com.google.android.gms.ads.AdActivity"

有錯誤說無法解析符號AdActivity。 我不確定是什么導致了這些問題,並希望得到一些幫助。

的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'
}

您需要在build.gradle中添加一行來編譯Google Play服務,請查看此處的文檔

因此,如果您使用的是最新版本的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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM