Jacksonkr
Jacksonkr

Reputation: 32207

Execution failed for task ':MyApp:dexDebug'

I recently switched from Eclipse to Android Studio and I'm having a problem getting my app to compile. I've dealt with a number of issues and have been able to solve them all except one:

Error:Execution failed for task ':MyApp:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

I read that this may mean you have duplicate jars so I checked my gradle config but it looks fine. I even went through and commented compiles out one-by-one (and many-to-one / one-to-many) with no avail. Here's my gradle config:

dependencies {
    compile project(':comcrashlyticssdkandroid_crashlytics_2')
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/gcm.jar');
}

My best guess is the libs/gcm.jar because gcm is "deprecated" to google play services. However, there is no gcm to play services migration so I'm stuck with gcm for now.

Another FYI is that I was getting a dex compilation issue in Eclipse but I would remove "Private Libraries" from the project and everything was fine. Is there an equivalent to this in Android Studio perhaps?

My biggest question is what do you suggest I try next to solve this issue?

Upvotes: 1

Views: 2186

Answers (1)

Jared Burrows
Jared Burrows

Reputation: 55517

You have:

dependencies {
    compile project(':comcrashlyticssdkandroid_crashlytics_2')
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/gcm.jar');
}

Try:

dependencies {
    compile project(':comcrashlyticssdkandroid_crashlytics_2')
    compile 'com.android.support:support-v4:22.2.1' // updated
    compile 'com.google.android.gms:play-services-analytics:7.5.0' // updated
    compile 'com.google.android.gms:play-services-gcm:7.5.0' // updated
}

and follow the updated guide: https://developers.google.com/cloud-messaging/android/client

and for crashlytics, use their config: http://docs.fabric.io/android/crashlytics/build-tools.html#gradle-advanced-setup

Docs: https://developers.google.com/android/guides/setup

Upvotes: 2

Related Questions