Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange Gradle Error

Tags:

android

gradle

My Gradle randomly stopped working when I upgraded to 8.2. I had been working with 8.1 previously and it was running well. I've noted that it is a gradle problem as it won't bring up a LogCat. Here's the gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId 'com.Hype.Hype'
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/Location/'] } }
productFlavors {
}
}

dependencies {

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

compile 'com.google.android.gms:play-services:5.0.77'
compile 'com.android.support:appcompat-v7:19.+'

compile 'com.android.support:support-v4:20.0.0'
}

and here's the error:

Error:Execution failed for task ':Hype:dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: /opt/android-studio/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /opt/Hype/Hype/build/intermediates/dex/debug /opt/Hype/Hype/build/intermediates/classes/debug /opt/Hype/Hype/build/intermediates/dependency-cache/debug /opt/Hype/Hype/build/intermediates/pre-dexed/debug/support-v4-19.1.0-bfe6379f31d17615f5ca4b83bd0a7235fba0720f.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/support-annotations-20.0.0-ac9eecc253fdba2831c82bc0dc80fba11be63671.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/internal_impl-20.0.0-b0cd61d02fc324aa2a414aecfa6fa63d5d33a68e.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/classes-514200de11abcc130af4614a253468bb032131c5.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/classes-fa2bce017d882684ab53055a2592668973f2d854.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/classes-b7bd0b7cbec94a8ac53e5fa6e712a05b7a389bdb.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/classes-0a4e6130fc95f4fb54dd696e45fe3207f155c4f2.jar Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103)

like image 231
user3822138 Avatar asked Jul 09 '14 20:07

user3822138


People also ask

Why is my Gradle build failing?

If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.


1 Answers

Looks like you include the same stuff twice. Check in libs/ that you don't have a support library jar.

like image 92
mbmc Avatar answered Sep 19 '22 02:09

mbmc