gpt4 book ai didi

android - list 合并失败 : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com. google.android.gms :play-services:7. 8.0]

转载 作者:太空狗 更新时间:2023-10-29 15:38:01 26 4
gpt4 key购买 nike

问题是

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

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中的代码

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 中的代码是..

<?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 服务。

这是因为 google play 在 SDK 9 (android 2.3) 以下的手机上不可用。另请参阅 the documentation:

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

  • A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
  • The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

你的选择是

  • 将您的 minSDK 提高到 9
  • 不要使用 google play 服务

关于android - list 合并失败 : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com. google.android.gms :play-services:7. 8.0],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32817227/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com