Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex #21

Open
faisal-khan16 opened this issue Dec 28, 2017 · 4 comments

Comments

@faisal-khan16
Copy link

when i run the sample project i get the above mentioned error.Please help me out in solving it.

@Swavis
Copy link

Swavis commented Jan 7, 2018

Same issue - Unable to merge dex, @faisal-khan16 did you find the solution?

@jagadeesh-vadivel
Copy link

jagadeesh-vadivel commented Feb 15, 2018

Same Issue -Do any one know the solution?

@lossen
Copy link

lossen commented Mar 5, 2018

Same Issue :((((

@clearbrian
Copy link

clearbrian commented Mar 13, 2018

when the dex error appear in red. Theres option to rerun in debug param.
This then shows error
Duplicate zip entry [gson-2.3.1.jar:com/google/gson/annotations/Expose.class
Caused by having gson.jar in the /libs and probably in the client
compile 'com.microsoft.projectoxford:vision:1.0.394'

/Cognitive-Vision-Android-master/Sample/app/libs/gson-2.3.1.jar

Ans: comment out the lines to include the lib in the project.

Note: other solutions to Dex error say to add
multiDexEnabled true
compile 'com.android.support:multidex:1.0.3'

But once I removed the compile jars the dex error went away.
I tend removed the
multiDexEnabled true
compile 'com.android.support:multidex:1.0.3'
and error didnt return so these arent needed

Note if you do have jar you need to include then just delete
/Cognitive-Vision-Android-master/Sample/app/libs/gson-2.3.1.jar
//compile files('libs/gson-2.3.1.jar')

FINAL WORKING GRADLE - 13 mar 2018

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27


    //    Warning:The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
    //    Android SDK Build Tools 26.0.2 will be used.
    //    To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    //
    //    remove "buildToolsVersion '25.0.2'"
    //buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.microsoft.projectoxford.visionsample"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 2
        versionName "1.1"

        //DEX ERROR - mentioned on Stackoverflow as solution but dex error disappear when you comment out compile files()/ compile fileTre
        //multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    //DEX ERROR - mentioned on Stackoverflow as solution but dex error disappear when you comment out compile files()/ compile fileTr
    //compile fileTree(dir: 'libs', include: ['*.jar'])


    // Use the following line to include client library for Vision API from Maven Central Repository
    compile 'com.microsoft.projectoxford:vision:1.0.394'
    compile 'com.android.support:appcompat-v7:27.1.0'


    //DEX ERROR FIX
    //Fixed by commenting this out and
    //compile files('libs/gson-2.3.1.jar')


    //DEX ERROR - mentioned on Stackoverflow as solution but dex error disappear when you comment out compile files()/ compile fileTre
    //left in in case error returns
    //compile 'com.android.support:multidex:1.0.3'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants