Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.android.build.transform.api.TransformException with android google play services

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()
    }
}
like image 654
srinu Avatar asked Oct 08 '15 05:10

srinu


3 Answers

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

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

    defaultConfig {
        multiDexEnabled true
    }
    
like image 140
vab Avatar answered Nov 10 '22 19:11

vab


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

like image 4
Omar Faroque Anik Avatar answered Nov 10 '22 18:11

Omar Faroque Anik


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.

like image 3
Nantoka Avatar answered Nov 10 '22 18:11

Nantoka