0

I have a problem when compiling my project, I get the error Execution failed for task ':app:dexDebug'. Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\Diana\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\Diana\Downloads\VoiceTranslator\app\build\intermediates\dex\debug --input-list=C:\Users\Diana\Downloads\VoiceTranslator\app\build\intermediates\tmp\dex\debug\inputList.txt 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:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106)

I know this question has been asked many times but I have tried the solutions from there and none of them works in my case.

This is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "imp.translator.diana.voicetranslator"
        minSdkVersion 9
        targetSdkVersion 22
        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:22.2.0'
    compile files('libs/android-support-v4.jar', 'libs/microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar')
}

Any ideas what might be wrong here? Any tip would be appreciated!

5
  • 1
    Hi! Have your tried to clean and rebuild the project? Commented Sep 13, 2015 at 6:53
  • possible duplicate of Unable to execute dex: Multiple dex files define Lcom/myapp/R$array; Commented Sep 13, 2015 at 6:54
  • @buzeeg yes, it doesn't work Commented Sep 13, 2015 at 6:56
  • invalidate cache and restart the android studio...then try with rebuilding the project Commented Sep 13, 2015 at 6:58
  • @ShadowDroid I have tried it now, doesn't work either Commented Sep 13, 2015 at 7:05

1 Answer 1

1

Remove 'libs/android-support-v4.jar' from compile files(...). This file is a transitive dependency of appcompat-v7 library.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.