carlosmuvi / SegmentedProgressBar

Instagram like segmented progress bar for Android, written in Kotlin!
132 stars 24 forks source link

Why does Gradle build fail with "Unable to merge dex" error after adding SegementProgressBar library? #13

Closed Jeel-Shah closed 6 years ago

Jeel-Shah commented 6 years ago

Hello,

After adding your library to my app's build.gradle, I get the following error message:

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

From what I can gather, this indicates that there is some kind of dependency issue. I tried resolving the issue by updating my google-services dependencies and updating android sdk to no avail. Furthermore, I am not using Kotlin to develop my application.

Is there a way to find which dependency might be causing this, if any?

Thanks a lot for your time!

Below I have posted my project build.gradle and my app build.gradle and information related to Android Studio version and JVM version.

Project build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "https://jitpack.io"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "[redacted]"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/rxjava.properties'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //    compile project(':cardstackview')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'org.igniterealtime.smack:smack-tcp:4.2.0'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.android.support:recyclerview-v7:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.android.support:gridlayout-v7:24.2.1'
    compile 'com.google.android.gms:play-services-maps:+'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'org.jetbrains:annotations-java5:15.0'
    compile 'com.google.android:flexbox:0.2.5'
    compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0'
    compile 'org.igniterealtime.smack:smack-android:4.2.0'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'io.reactivex:rxjava:1.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'com.github.carlosmuvi:SegmentedProgressBar:0.6.0'
    testCompile 'junit:junit:4.12'
}

More Specs

Android Studio 3.0
Build #AI-171.4408382, built on October 20, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Jeel-Shah commented 6 years ago

I resolved this issue by downgrading my gradle version to 2.3.3 and changing my buildToolsVersion to 25.0.0.