Top-level Exception application: dexDebug --dex -no-optimize --outroid studio

I port my Android code from Eclipse to Android studio and am stuck in the following error. The project builds thin and synchronizes with gradle, but it generates the following compilation error.

UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to execute the command: / home / Work / adt -bundle-linux-x86-20130729 / sdk / build-tools / 21.1.2 / dx --dex --no- optimize --output / home / Work / Roadblock / Projects for Android Studio New / app / build / intermediates / dex / debug --input-list = / home / Work / Roadblock / Projects for Android Studio New / app / build / intermediates /tmp/dex/debug/inputList.txt Error code: 2 Output: UNCERTAIN TOP LEVEL EXCLUSION: com.android.dex.DexException: several dex files define Landroid / support / v4 / view / PagerAdapter; at com.android.dx.merge.DexMerger.readSortableTypes (DexMerger.javaβˆ—96) at com.android.dx.merge.DexMerger.getSortedTypes (DexMerger.java UP54) at com.android.dx.merge.DexMerger.mergeClassDefs (DexMerger.javaβˆ—35) at com.android.dx.merge.DexMerger.mergeDexes (DexMerger.java:171) on com.android.dx.merge.DexMerger.merge (DexMerger.java:189) on com.android.dx.command.dexer.Main.mergeLibraryDexBuffers (Main.java:454) on com .android.dx.command.dexer.Main.runMonoDex (Main.java:303) on com.android.dx.command.dexer.Main.run (Main.java:246) on com.android.dx.command.dexer .Main.main (Main.java:215) on com.android.dx.command.Main.main (Main.java:106) Information: BUILD FAILED Information: Total time: 22,183 sec.java: 215) on com.android.dx.command.Main.main (Main.java:106) Information: BUILD FAILED Information: Total time: 22,183 sec.java: 215) on com.android.dx.command.Main.main (Main.java:106) Information: BUILD FAILED Information: Total time: 22,183 sec.

jars library

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
}

. . inputList.txt, /home/Work/Roadblock/Android Studio Projects New/app/build/intermediates/tmp/dex/debug/inputList.txt, , .

(Android Studio, ) , , , .gradle. , , .

:

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "package.app"
    minSdkVersion 8
    targetSdkVersion 18
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
    }
}

dependencies {
compile project(':facebookSDK')
compile project(':library')
compile project(':newPagerIndicator')
compile project(':pulltorefreshlib')
compile project(':volley')
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile files('libs/FlurryAnalytics_3.3.3.jar')
compile files('libs/crittercism_v3_2_0_sdkonly.jar')
compile files('libs/httpmime-4.2.5.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/picasso-2.3.3.jar')
compile files('libs/universal-image-loader-1.8.4.jar')
}
+1
1

Android- com.android.dex.DexException: dex Landroid/

exclude

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar', exclude: 'android-support-*.jar')
    //...
}

dex Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat , exclude module: 'support-v4'

dependencies {
    compile('com.commonsware.cwac:camera-v9:0.5.4') {
      exclude module: 'support-v4'
    }

    compile 'com.android.support:support-v4:18.0.+'
}

( Gradle JAR, classes.jar)

+1

Source: https://habr.com/ru/post/1570423/


All Articles