0

build.gradle file:

android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "xxxxx.com.myapp" minSdkVersion 9 targetSdkVersion 22 versionCode 3 versionName "1.2" } 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:22.1.1' compile 'com.google.android.gms:play-services-ads:7.3.0' compile files('libs/libGoogleAnalyticsServices.jar') } 

Error Log:

FAILURE: Build failed with an exception.

  • 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_51\bin\java.exe'' finished with non-zero exit value 2

4
  • Are any of your dependencies conflicting? What jars do you have in libs? You are also adding libGoogleAnalyticsServices.jar twice since at the beginning you add all jars in your libs folder, then you explicitly add this one again at the end. Try removing it. Commented Sep 3, 2015 at 4:32
  • getting same error after removing compile files('libs/libGoogleAnalyticsServices.jar') Commented Sep 3, 2015 at 4:48
  • Can you post what jars are in your libs folder? Maybe there are more conflicts. Commented Sep 3, 2015 at 4:48
  • Only One jar in my Lib folder libGoogleAnalyticsServices.jar Commented Sep 3, 2015 at 6:12

3 Answers 3

4

Try removing the following from your dependencies:

compile fileTree(dir: 'libs', include: ['*.jar']) compile files('libs/libGoogleAnalyticsServices.jar') 

If you look here, the Analytics API is already built into Google play services, so the two are conflicting.

Sign up to request clarification or add additional context in comments.

Comments

2

Sometimes this build failed error occures due to multidex problem. As per looking into your build script it does not seems that you need multidex enabling ture. But still you can try this because I can not say much just seeing your gradle build script.Use

 defaultConfig { applicationId "xxxxx.com.myapp" minSdkVersion 9 targetSdkVersion 22 versionCode 3 versionName "1.2" // enable Mutidex. multiDexEnabled true } 

Comments

0

You are including libGoogleAnalyticsServices.jar twice. Based in the path, it will be include by the following line (which includes all jars in the libs directory) --

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

remove this line to avoid including the lib twice --

compile files('libs/libGoogleAnalyticsServices.jar') 

2 Comments

getting same error after removing compile files('libs/libGoogleAnalyticsServices.jar')
Try cleaning/rebuild after you do your gradle sync. in case the dependencies were cached. What other files do you have your libs directory? And can you grab more of that error, there is usually a stack trace above it. It will give you some guidance about what the issue is.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.