Execution failed for task ': app: transformClassesWithDexForDebug' when implementing Google for Android

I am trying to implement Google for Android and I am following the instructions through

https://developers.google.com/identity/sign-in/android/start-integrating

But when creating the application, I get the following error.

Info: Gradle tasks [: app: generateDebugSources ,: app: generateDebugAndroidTestSources ,: app: assembleDebug]: app: preBuild UP-TO-DATE: app: preDebugBuild UP-TO-DATE: app: checkDebugManifest: app: preReleaseBuild UP-TO- DATE: app: prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE: app: prepareComAndroidSupportDesign2301Library UP-TO-DATE: app: prepareComAndroidSupportSupportV42301Library UP-TO-DATE: app: prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE: Appendix: prepareComGoogleAndroidGmsPlayServicesAnalytics810Library Timeliness: Appendix: prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO- DATE: application: prepareComGoogleAndroidGmsPlayServicesBase810Library TIMELY: Application: prepareComGoogleAndroidGmsPlayServicesBasement810Library TIMELY: Application: prepareComGoogleAndroidGmsPlayServicesIdent ity810Library TIMELY: Application: prepareComGoogleAndroidGmsPlayServicesMeasurement810Library UP-TO-DATE: application: prepareComGoogleAndroidGmsPlayServicesPlus810Library UP-TO-DATE: application: prepareDebU-TODATE -DBU TODDug-TOFDUdUnTUpDDug-TOUGE DATE: application: generateDebugAssets UP-TO-DATE: application: mergeDebugAssets UP-TO-DATE: app: generateDebugResValues ​​UP-TO-DATE: application: processDebugGoogleServices No matching client found for package name 'com.questo.rugved.questo' : app: generateDebugResources: app: mergeDebugResources UP-TO-DATE: app: processDebugManifest UP-TO-DATE: application: processDebugResources UP-TO-DATE: application: generateDebugSources UP-TO-DATE: application: preDebugAndroidTestBuild UP-TO-DATE etc position: prepareDebugAndroidTestDependencies: app: compileDebugAndroidTestAidl UP-TO-DATE: app: processDebugAndroidTestManifest UP-TO-DATE: app: compileDebugAndroidTestRenderscript UP-TO-DATE: appDateAutroidTestUtA-DTuGuideTestUtug-AppDigug : mergeDebugAndroidTestAssets UP-TO-DATE: app: generateDebugAndroidTestResValues ​​UP-TO-DATE: app: generateDebugAndroidTestResources UP-TO-DATE: app: mergeDebugAndroidTestResources UP-TO-DATE: app: processDebugAndroidDestRundAndroidTestDDTREDAndroidTestReadAndroidTendRndAndroidTestRate -TO-DATE: app: compileDebugJavaWithJavac UP-TO-DATE: application: compileDebugNdk UP-TO-DATE: application: compileDebugSources UP-TO-DATE: Application: transformClassesAndResourcesWithExtractJarsForDebug: APPROXIMATE FULL tasks': Application: transformClassesWithDexForDebug. com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: process command '/ usr / lib / jvm / java-7-oracle / bin / java '' finished with a non-zero output value 2 Information: BUILD FAILED Information: Total time: 1 min 39.994 secs Information: 1 error Information: 0 warnings Information: See the full output in the console

My top level gradle is

     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 ()
         }
     }
    
My app level gradle is <pre> apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 23 buildToolsVersion '23.0.1' defaultConfig { applicationId "com.questo.rugved.questo" 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' compile 'com.android.support:design:23.+' compile 'com.google.android.gms:play-services-identity:8.1.0' compile 'com.google.android.gms:play-services-plus:8.1.0' } 

Please, help.

+13
android android-gradle gradle google-signin
Oct 27 '15 at 13:22
source share
4 answers

Perhaps this link will help you. link

It helped me:

 android { ... defaultConfig { ... multiDexEnabled true } } 
+20
Nov 01 '15 at 0:37
source share

This issue occurs because of multiple dependency inclusion. You include the dependency that is already specified in the build.gradle file. For example:

 compile 'com.google.android.gms:play-services:9.0.2' compile 'com.google.android.gms:play-services-identity:9.0.2' 

the above dependency specification will create this problem, since game services include everything, including character identification, and thus, the same dependency is included several times.

The recommended option is only to include the dependencies that you really need. If you need the location of the game services and maps, include only these dependencies as:

 compile 'com.google.android.gms:play-services-location:9.0.2' compile 'com.google.android.gms:play-services-maps:9.0.2' 

Without including everything with 'com.google.android.gms: play-services: 9.0.2'.

In your particular case, I suspect that a conflict occurs between the google services of the top-level gradle file and play-services-identity and play-services-plus in the gradle application level file. Using only the services you need to enable multiple inclusion will solve your problem.

In general, you should not use "multiDexEnabled true" unless you have a strong and legitimate reason. Using this without knowing the actual problem means you are getting around the problem. You allow multiple overlapping dependencies giving a potential source of api conflicts and a larger apk size.

+4
Jun 12 '16 at 19:03
source share

Adding

  dexOptions { incremental = true; preDexLibraries = false javaMaxHeapSize "4g" // 2g should be also OK } 

in with inroid in build.gradle works for me.

+3
Mar 31 '16 at 5:43
source share

There was the same problem.
Mine has been fixed by setting the JAVA_HOME variable in java 8 jdk

 export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/" 
+1
Aug 20 '16 at 7:59
source share



All Articles