7

I'm trying to integrate Google Plus in my application, and it showing following error. below are exception and gradle

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

com.android.build.transform.api.TransformException: 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

app build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "xxx.com.xxxx"
        multiDexEnabled true
        minSdkVersion 15
        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.0.1'
    //depend-materialcalendar
    compile 'com.prolificinteractive:material-calendarview:0.8.1'
    compile 'com.android.support:gridlayout-v7:23.0.1'
    compile 'com.android.support:cardview-v7:23.0.1'
    compile 'com.melnykov:floatingactionbutton:1.3.0'
    //depend-cometchat
    compile 'com.yalantis:contextmenu:1.0.4'
    compile 'com.google.code.gson:gson:2.3'
    compile files('libs/appcompat_v7.jar')
    compile files('libs/cometchat-sdk.jar')
    compile files('libs/jsoup-1.7.3.jar')
    compile files('libs/picasso-2.5.2.jar')
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.google.android.gms:play-services-base:8.1.0'
    compile 'com.google.android.gms:play-services-maps:8.1.0'
    compile files('libs/volley.jar')
    compile files('libs/PayPalAndroidSDK.jar')
    compile files('libs/gcm.jar')
    compile 'com.soundcloud.android:android-crop:1.0.1@aar'
    compile 'com.facebook.android:facebook-android-sdk:4.6.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.google.android.gms:play-services-plus:8.1.0'
    compile 'com.google.android.gms:play-services-identity:8.1.0'

}

project build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.google.gms:google-services:1.4.0-beta3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
srinu
  • 266
  • 1
  • 5
  • 18

5 Answers5

14
  1. Try cleaning your project and then re-building.

  2. Try adding multiDexEnabled true in your app build.gradle file.

    defaultConfig {
        multiDexEnabled true
    }
    
Satan Pandeya
  • 3,747
  • 4
  • 27
  • 53
vab
  • 723
  • 7
  • 15
  • 2
    searched on google developer.. it says app size exceeds 65k. i think thats true, beacause just now integrated with sample application and its works fine – srinu Oct 08 '15 at 07:05
  • 1
    Also, this might not be a dex issue, as per this answer: http://stackoverflow.com/a/33026958/1174453 removing the build and app/build folders might fix this as well - although I did have to exclude an extraneous support-v4 lib that was getting pulled in with the facebook-sdk before this would work, implying that the 65k method limit is at least partially at play here. – alphanumeric character Nov 04 '15 at 02:09
  • Deleting build folders and removing support library worked for me. – Zapnologica Nov 04 '15 at 16:56
4

I have added this on the Application class:

 @Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

In my app build.grade file:

 defaultConfig {
    applicationId "com.example.android.exampleapp"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

}

and added this as dependency:

     compile 'com.android.support:multidex:1.0.0'

This solved my problem. Thanks

Omar Faroque Anik
  • 2,531
  • 1
  • 29
  • 42
3

I just had the same problem in my current project when I moved the Android Gradle Plugin Version from 1.3.0 to 1.5.0.

The error was nearly the same one as the error of the OP except that java returned error code 2.

If finally turned out that I had the same jar file included in two different modules of the app.

Version 1.3.0 could handle this without problems, for version 1.5.0 I had to replace the jar files with a dependency for a separate module that contained a single copy of the jar file.

Nantoka
  • 4,174
  • 1
  • 33
  • 36
0

I have tried with adding

   multiDexEnabled true

but did not work. then I have changed my build version from 23.0.2 to

  buildToolsVersion "23.0.3"

then it works. hope it may help you.

Milon
  • 2,221
  • 23
  • 27
0

try to add these line in your gradle

dexOptions {
    javaMaxHeapSize "4g"
}
Ankur1994a
  • 2,112
  • 2
  • 13
  • 18