错误:(8,5)使用-sdk:minSdkVersion 8不能小于库中声明的版本9

时间:2015-02-28 14:08:35

标签: android

我正在尝试按照本教程

Link

我完成了所有事情后,清单中的错误

Error:(8, 5) uses-sdk:minSdkVersion 8 cannot be smaller than version 9                declared in library     C:\Users\Zezo2\AndroidStudioProjects\AndroidPushNotificationsUsingGCM1\app\build    \intermediates\exploded-aar\com.google.android.gms\play-    services\6.5.87\AndroidManifest.xml


Error:(8, 5) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than      version 9 declared in library C:\Users\Zezo2\AndroidStudioProjects\AndroidPushNotificationsUsingGCM1\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\6.5.87\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms" to force usage

这是我的build.geadle

    apply plugin: 'com.android.application'

android {
compileSdkVersion 'Google Inc.:Google APIs:8'
buildToolsVersion "21.1.1"

defaultConfig {
    applicationId "com.androidhive.pushnotifications"
    minSdkVersion 8
    targetSdkVersion 16
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

}

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.android.gms:play-services:+'

}

1 个答案:

答案 0 :(得分:4)

基本上,您使用的库具有您需要的最低SDK版本..

uses-sdk:minSdkVersion 8 cannot be smaller than version 9

您需要编辑Android项目以更新minSdkVersion

  • 更新src / build.gradle - 确保是src文件夹下的那个
  • 同步草图按钮
  • 重建项目
  • 更新build.gradle minSdkVersion后,您必须单击 用于同步gradle文件的按钮(“将项目与Gradle文件同步”)。