I am trying to integrate Push notifications in an existing Android app (using Android studio) following steps from here.
When I add the following dependency compile 'com.google.android.gms:play-services:7.5.0', gradle syncronization lasts forever (lasts more than 50 minutes, even more since I never waited till the end). But when I put this depencency: compile 'com.google.android.gms:play-services-gcm:7.5.0' it works fine (lasts about 19 minutes. There are about 20 dependencies in this project).
Those are some of the dependencies that are used in this project:
dependencies {
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.android:google-play-services:4.1.32'
compile 'com.devsmart.android:devsmart-lib:1.0.0'
compile 'com.jeremyfeinstein.slidingmenu.lib:sliding-menu:1.0.0'
compile 'com.viewpagerindicator:viewpager-indicator:2.4.1'
//compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:google-play-services_lib:4.1.32'
//compile 'com.google.android.gms:play-services-maps:7.5.0'
//compile 'com.google.android.gms:play-services-location:7.5.0'
compile 'com.emilsjolander:sticky-list-headers:1.0.0'
compile 'com.actionbarsherlock:actionbar-sherlock:4.2.0'
.
.
.
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
enforceUniquePackageName = false
dexOptions {
preDexLibraries = false
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
.
.
.
I know that I am using some libraries more than once (google play library):
compile 'com.google.android:google-play-services:4.1.32'
compile 'com.google.android.gms:google-play-services_lib:4.1.32'
But project won't work without them, since some classes are important to this project, and it is not my role to change it (just to integrate push notifications in this concept).
Since non of those two libraries have GcmListenerService class (at least I am getting error it doesn't exist) I have to put another google play module dependency:
compile 'com.google.android.gms:play-services-gcm:7.5.0'
And now, when i put this dependency and start syncorinization, everything works fine and smooth, except when I try to run the application. Then I get this error:
java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/gcm/GoogleCloudMessaging;
.
.
.Error:Execution failed for task ':CA:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1