清单合并失败:uses-sdk:minSdkVersion 8不能小于在库[com.google.android.gms:play-services:7.8.0]中声明的版本9. [英] Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com.google.android.gms:play-services:7.8.0]

查看:56
本文介绍了清单合并失败:uses-sdk:minSdkVersion 8不能小于在库[com.google.android.gms:play-services:7.8.0]中声明的版本9.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是

错误:任务':app:processDebugManifest'的执行失败.

Error:Execution failed for task ':app:processDebugManifest'.

清单合并失败:uses-sdk:minSdkVersion 8不能小于在库[com.google.android.gms:play-services:7.8.0]中声明的版本9,C:\ Users \ atif \ androidstudioprojects \ AndroidPushNotificationsUsingGCM \app \ build \ intermediates \ exploded-aar \ com.google.android.gms \ play-services \ 7.8.0 \ AndroidManifest.xml建议:使用tools:overrideLibrary ="com.google.android.gms.all"强制使用

Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com.google.android.gms:play-services:7.8.0] C:\Users\atif\androidstudioprojects\AndroidPushNotificationsUsingGCM\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\7.8.0\AndroidManifest.xml Suggestion: use tools:overrideLibrary="com.google.android.gms.all" to force usage

build.gradle中的代码

The code in build.gradle

apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:8'
buildToolsVersion "23.0.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:+'
}

AndroidManifest中的代码是..

Code in the AndroidManifest is ..

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.pushnotifications"
android:versionCode="1"
android:versionName="1.0" >

<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" />

<!-- GCM connects to Internet Services. -->
<uses-permission android:name="android.permission.INTERNET" />

<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- Creates a custom permission so only this app can receive its messages. -->
<permission
    android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE" />

<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<!-- Network State Permissions to detect Internet status -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />

<!-- Main activity. -->
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <!-- Register Activity -->
    <activity
        android:name=".RegisterActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!-- Main Activity -->
    <activity
        android:name=".MainActivity"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name" >
    </activity>

    <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>

            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <!-- Receives the registration id. -->
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.androidhive.pushnotifications" />
        </intent-filter>
    </receiver>

    <service android:name=".GCMIntentService" />
</application>

请帮我谢谢.

推荐答案

您收到该错误,因为您将minSDK指定为8,而您至少需要minSDK 9才能使用Google Play服务.

You're getting that error because you have specified minSDK as 8, while you need at least minSDK 9 to use google play services.

这是因为Google Play在SDK 9(android 2.3)以下的手机上不可用.另请参阅文档:

This is because google play is not available on phones below SDK 9 (android 2.3). Also refer to the documentation:

要在使用Google Play服务SDK时测试您的应用,您必须使用要么:

To test your app when using the Google Play services SDK, you must use either:

  • 运行Android 2.3或更高版本并包含Google Play商店的兼容Android设备.
  • 带有AVD的Android模拟器,该模拟器运行基于Android 4.2.2或更高版本的Google API平台.

您的选择是

  • 将您的minSDK提升到9
  • 不要使用Google Play服务

这篇关于清单合并失败:uses-sdk:minSdkVersion 8不能小于在库[com.google.android.gms:play-services:7.8.0]中声明的版本9.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆