1

I'm trying to build an Android project and am getting this error with Multidex enabled:

Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android-simple-host:transformDexArchiveWithDexMergerForDebug'.

Here is the build file:

plugins {
    id("com.android.application")
    kotlin("android")
    kotlin("android.extensions")
}

android {
    compileSdkVersion(28)
    defaultConfig {
        applicationId = "org.tenkiv.kuantify.simple_host"

        minSdkVersion(26)
        targetSdkVersion(28)
        versionCode = 1
        versionName = "1.0"
        multiDexEnabled = true
        testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        getByName("release") {
            isMinifyEnabled = false
        }
    }

    sourceSets {
        getByName("main").java.srcDirs("src/main/kotlin")
        getByName("test").java.srcDirs("src/test/kotlin")
    }

    packagingOptions {
        pickFirst("META-INF/**")
        pickFirst("tec/units/indriya/format/messages.properties")
    }
}

dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
    implementation(project(":android-local"))
    implementation(group = "io.ktor", name = "ktor-server-netty", version = Vof.ktor)
    testImplementation(group = "junit", name = "junit", version = Vof.junit)
}

and I did a build scan that you can view here (because the project is quite large).

I am seriously confused as to why this is happening when multiDex is already enabled. My best guess is that there is some sort of library conflict due to the chain of gradle dependencies, but as far as I know, gradle will remove duplicate dependencies when building by default, no?

Any help would be appreciated!

EDIT: Disabling Android D8 in gradle.properties made the build able to compile, but this isn't a long-term solution. Narrows down the problem a tiny bit, however! (But is still very confusing)

Shan
  • 541
  • 3
  • 11

0 Answers0