0

I want to use GCM on API level 2.2 but the Android Studio is giving Error that

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

Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library D:\New folder\AndroidStudioProjects\GCMExample\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.3.0\AndroidManifest.xml Suggestion: use tools:overrideLibrary="com.google.android.gms.all" to force usage

I know that changing my compiledSdkVersion to 9 will solve the error but i want to support API level 2.2 on my App

I read this Google Link

https://developers.google.com/cloud-messaging/android/client

It says that :

GCM requires devices running Android 2.2 or higher that also have the Google Play Store application installed, or an emulator running Android 2.2 with Google APIs.

my build.gradle file :

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.hogo.gcmapp"
    minSdkVersion 8
    targetSdkVersion 23
    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:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

So, Why I am not able to use GCM on API level 2.2 ?

What I am doing wrong ?

Thanks in Advance...

Ashish Shukla
  • 1,027
  • 16
  • 36
  • have you read this : If you want to support pre-4.4 KitKat devices, add the following action to the intent filter declaration for the receiver: – Gaurav Dec 03 '15 at 07:53
  • would adding that line, studio will not ask for changing my compileSdkVersion to 9 ? – Ashish Shukla Dec 03 '15 at 08:46
  • You can try to set up your project as posted [here](http://stackoverflow.com/questions/33923223/android-gcm-instanceid-gettoken-throws-timeout-exception-on-gingerbread?noredirect=1#comment55816862_33923223). After you set it up, it should work on API 9. Note that you have to try to use real devices for testing. – bjiang Dec 03 '15 at 21:07
  • @bjiang I want to support from API level 8 – Ashish Shukla Dec 04 '15 at 05:30
  • That's should be the same and try to use the official repo here:https://github.com/google/gcm/tree/master/samples/android/gcm-demo – bjiang Dec 04 '15 at 05:31
  • ok i will try and update – Ashish Shukla Dec 04 '15 at 12:45

2 Answers2

1

It depends on which GCM-API you use. The bullet point below the one you cited says:

However, if you want to continue to use new GCM features that are distributed through Google Play Services, the device must be running Android 2.3 or higher, or you can use an emulator running Android 2.3 with Google APIs.

You compile *.gms:play-services-gcm:8.3.0 which obviously is distributed with play services. So if you really want to support 2.2-devices you need the old and deprecated GCM-APIs but since only 0.2% of all Android devices still use that version you could just go with SDK 10 and benefit from all the features GCM provides nowadays.

sschmid
  • 1,341
  • 1
  • 16
  • 22
1

Finally the problem is Solved guys.

Just Open the Standalone SDK Manager and check the Obsolete checkbox in bottom

You will see the Obsolete Froyo Library below in image.

enter image description here

After that just follow this post :

How to add Google Play Services for Froyo to the project using Gradle?

and thats it.

Also just take a look at this post :

Is Google Play Services for Froyo compatible with Android 2.3 and higher?

Hope it Helps someone:)

Community
  • 1
  • 1
Ashish Shukla
  • 1,027
  • 16
  • 36