:app:dexDebug on adding libGoogleAnalyticsServices

1.8k views Asked by At

On trying to run my project, I get the following error:

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

I am adding the google analytics jar file from here. The issue goes away if I remove this line compile files('libs/libGoogleAnalyticsServices.jar') from the dependencies in the build.gradle

Is 1libGoogleAnalyticsServices.jar` interfering with something else I have in my dependencies?

dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.1'
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/newrelic.android.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.google.android.gms:play-services:7.5.0'
compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {

}

compile ("com.doomonafireball.betterpickers:library:1.6.0")

compile ("com.doomonafireball.betterpickers:library:1.6.0") {
    transitive = true
    exclude group: 'com.android.support', module: 'support-v4'
}
compile project(':circularImageView')

}
2

There are 2 answers

0
Oguz Ozcan On BEST ANSWER

This error could also indicate that you've hit the 65k method limit in Android. If this is the case, then you have 3 options

Selectively use the parts of the play-services library that are required. This library itself will bring you close to the limit. Let Progaurd minimize your application.

Use Multi-dex to split your dex index.

These guides will help you to achieve the options above;

http://googleadsdeveloper.blogspot.ie/2015/01/reducing-google-play-services-impact-on.html

https://developer.android.com/tools/building/multidex.html

0
ianhanniballake On

Per the page you linked:

Important: This document describes a legacy version of the SDK. New users should use the latest SDK.

As the latest SDK is included in your 'com.google.android.gms:play-services:7.5.0' dependency, the two are overlapping and causing issues when building your application. You should instead follow the getting started guide for Google Analytics v4