0

I am facing this error during the build: "D8 does not support main-dex inputs and outputs when compiling to API level 21 and above"

If i set minifyEnabled to true in debug buildType everything works fine, but if i set it to false i just get this error.

My gradle file:

android {
compileSdkVersion 28

defaultConfig {
    applicationId "com.generalbytes.batm"
    minSdkVersion 17
    targetSdkVersion 22
    multiDexEnabled true

    ndk {
        abiFilters 'armeabi-v7a'
    }
}

useLibrary 'org.apache.http.legacy'

testOptions {
    unitTests.all {
        enabled !useDummyBitRafael.toBoolean()
    }
}


signingConfigs {
    release {
        storeFile rootProject.file(releaseStoreFile)
        storePassword releaseStorePassword
        keyAlias releaseKeyAlias
        keyPassword releaseKeyPassword
    }
    debug {
        storeFile rootProject.file(releaseStoreFile)
        storePassword releaseStorePassword
        keyAlias releaseKeyAlias
        keyPassword releaseKeyPassword
    }
}

buildFeatures {
    dataBinding = true
    viewBinding = true
}

buildTypes {
    debug {
        minifyEnabled false
    }
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
}

lintOptions {
    tasks.lint.enabled = false
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

testOptions {
    unitTests.returnDefaultValues = true
}

Any ideas?

Houskov
  • 338
  • 1
  • 9
  • According to [source code](https://r8.googlesource.com/r8/+/refs/heads/master/src/main/java/com/android/tools/r8/D8Command.java#211), this error is being thrown when minSdkVersion is set to 21 and `--main-dex-list` option is being used; however - your build.gradle file declares 17 as minSdkVersion and I don't see any usage of `--main-dex-list`. Maybe one of the library modules trigger this behavior? – Alex Lipov Jun 12 '20 at 06:59
  • If possible can you open an issue on the R8 issue tracker https://issuetracker.google.com/issues/new?component=326788? – sgjesse Jun 12 '20 at 11:45

1 Answers1

0

I just click "refresh gradle dependencies" from Android studio Gradle view and then the problem disappear.

Hexise
  • 1,520
  • 15
  • 20