Com.android.build.transform.api.TransformException using android google play services

I am trying to integrate Google Plus in my application and showing the following error. below are exceptions and gradle

Error: execution completed 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 '' completed with nonzero exit value 1

build.gradle application

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' } 

build.gradle project

 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() } } 
+7
android android-studio google-play-services build.gradle google-plus
source share
6 answers
  • Try to clean the project and then rebuild.

  • Try adding multiDexEnabled true to the build.gradle application build.gradle .

     defaultConfig { multiDexEnabled true } 
+14
source share

I added this to the Application class:

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

In my application build.grade file:

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

and added this as a dependency:

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

This solved my problem. Thanks

+4
source share

I 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 almost the same as the OP error, except that java returned error code 2.

If, finally, it turned out that I had the same jar file that was included in two different application modules.

Version 1.3.0 can handle this without problems, for version 1.5.0 I had to replace the jar files with a dependency for a separate module containing one copy of the jar file.

+3
source share

I tried to add

  multiDexEnabled true 

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

  buildToolsVersion "23.0.3" 

then it works. Hope this can help you.

0
source share

try adding this line to gradle

 dexOptions { javaMaxHeapSize "4g" } 
0
source share

just delete your support libraries and it will work

-3
source share

All Articles