2 files found with path ‘androidsupportmultidexversion.txt’ from inputs

This error happens when I try to build or running my app

> Task :app:mergeDebugJavaResource FAILED
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'androidsupportmultidexversion.txt' from inputs:
      - C:UsersUser.gradlecachestransforms-2files-2.1eea432b5b906aa8ac69bbc0cbb8ebb90multidex-2.0.1jarsclasses.jar
      - C:UsersUser.gradlecachestransforms-2files-2.1da650fcfe296862d40a84f8e3b03a132multidex-1.0.3jarsclasses.jar
     Adding a packagingOptions block may help, please refer to
     https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
     for more information

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

build.gradle file

plugins {
    id 'com.android.application'
    id("dagger.hilt.android.plugin")

}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.mml.pokemon"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude("META-INF/*.kotlin_module")
        exclude 'project.properties'
        exclude 'META-INF/INDEX.LIST'
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'


    def room_version = "2.2.5"
    def nav_version = "2.3.0-beta01"

    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation 'com.android.support:multidex:1.0.3'

    // Hilt
    implementation "com.google.dagger:hilt-android:2.36"
    annotationProcessor 'com.google.dagger:hilt-android-compiler:2.36'
    implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
    annotationProcessor 'androidx.hilt:hilt-compiler:1.0.0'

    //RxJava
    implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
    implementation 'io.reactivex.rxjava3:rxjava:3.0.3'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation "com.github.akarnokd:rxjava3-retrofit-adapter:3.0.0"

    // ViewModel
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.3.1'

    // LiveData
    implementation 'androidx.lifecycle:lifecycle-livedata:2.3.1'

    // Room
    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-rxjava2:$room_version"

    // Navigation
    implementation "androidx.navigation:navigation-fragment:$nav_version"
    implementation "androidx.navigation:navigation-ui:$nav_version"

    // Glide
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

    //sdp
    implementation 'com.intuit.sdp:sdp-android:1.0.6'

    def multidex_version = "2.0.1"
    implementation "androidx.multidex:multidex:$multidex_version"

}

What I understood from this error is that there’s 2 versions of multidex in this path, and to fix this I tried the following:

  1. delete the old version of multidex "1.0.3" from this path "C:UsersUser.gradlecachestransforms-2files-2.1da650fcfe296862d40a84f8e3b03a132multidex-1.0.3jarsclasses.jar" and keep the newer one.
  2. adding package option from this answer like this
packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude("META-INF/*.kotlin_module")
        exclude 'project.properties'
        exclude 'META-INF/INDEX.LIST'
    }
  1. I tried also to remove multiDexEnabled true from file and add it like this
dependencies {
    def multidex_version = "2.0.1"
    implementation 'androidx.multidex:multidex:$multidex_version'
}

unfortunately all this tries to fix didn’t work

Source: Android Questions

7 thoughts on - 2 files found with path ‘androidsupportmultidexversion.txt’ from inputs

LEAVE A COMMENT