0

I'm trying to add google play services for GCM in my app but couldn't achieve it.

  • What went wrong: Execution failed for task ':app: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 2

If I remove compile 'com.google.android.gms:play-services-gcm:8.1.0' then there is no problem in building. Where I'm going wrong?

Build.gradle File:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "xxx.yyy.zzz"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
}

dexOptions {
    jumboMode true
    incremental true
    preDexLibraries false
    javaMaxHeapSize "4g"
}
}

 dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.google.code.gson:gson:2.3'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.google.android:multidex:0.1'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.google.android.gms:play-services-analytics:7.3.0'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.afollestad:material-dialogs:0.7.4.2'
 }
Santhosh
  • 4,956
  • 12
  • 62
  • 90

2 Answers2

1

You might be having outdated support repositories in sdk mananger

Try This:

Right Click on app and Open module settings on Dependencies Tab

click '+' icon and add there com.google.android.gms:play-services and click search icon and add that dependency the right version should popup according to your repositories.

EDIT:

enter image description here

Vishavjeet Singh
  • 1,385
  • 11
  • 13
0

After adding the dependencies, try to remove the build/ and app/build/ folders, then build the project again.

If it does not fix your issue, you will need to provide the full gradle log.

3lil636wm
  • 7,580
  • 3
  • 24
  • 26