Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

While generating signed APK, "androidx.legacy_legacy-support-core-utils.version collided" error occurs

While trying to generate signed APK it shows the following error message.

Entry name 'META-INF/androidx.legacy_legacy-support-core-utils.version' collided

Previously it was working correctly for couple of years. Additionally i have checked in another PC with same android studio and same gradle version, it is working correctly in that PC. I am experiencing this issue in particular one PC itself why? I have attached the build.gradle below.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 29
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        vectorDrawables {
            useSupportLibrary = true
        }
    }

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }


    //--Test
    lintOptions {
        checkReleaseBuilds false
    }



    flavorDimensions "default"



    buildTypes {
        publicDebug {
            minifyEnabled false
            initWith debug
            //shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'


        }



        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }

    sourceSets {
        main {
            res.srcDirs =
                    [
                            'src/main/res/layouts/stripchart/layout',
                            'src/main/res/layouts/stripchart',
                            'src/main/res/layouts/erfi/layout',
                            'src/main/res/layouts/erfi',
                            'src/main/res/layouts',
                            'src/main/res'
                    ]
        }
    }

    android {
        useLibrary 'org.apache.http.legacy'
    }

}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    // Glide image library
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    //material design
    implementation 'com.google.android.material:material:1.0.0'
    //Circular Image view
    implementation 'com.mikhaellopez:circularimageview:3.0.2'
    //Expandable layout
    implementation 'com.github.florent37:expansionpanel:1.1.1'
    //Vector drawables\
    implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
    //Animated jsons
    implementation 'com.airbnb.android:lottie:3.4.0'
    // Dexter runtime permissions
    implementation 'com.karumi:dexter:6.0.2'
    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    //DotsIndicator
    implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:2.0.3'
    //DateTimePciker BottomSheet
    implementation 'com.github.florent37:singledateandtimepicker:2.0.4'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    //Location settings
    implementation 'io.nlopez.smartlocation:library:3.3.3'
    implementation 'androidx.legacy:legacy-support-v13:1.0.0'

    implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.4.0'

    //Digital Signature
    implementation 'com.kyanogen.signatureview:signature-view:1.0'

    // Shimmer
    // implementation 'com.facebook.shimmer:shimmer:0.5.0'

}

Kindly anyone help to solve this. Where i missed out anything?

like image 288
Viswa Sundhar Avatar asked Jun 15 '20 08:06

Viswa Sundhar


Video Answer


2 Answers

I found the origin of issue. It was in the output.json. It is the culprit. That file corrupted due to some activities. We have to delete the file from the destination folder of Signed APK generation. It fixed the issue.

like image 120
Viswa Sundhar Avatar answered Oct 27 '22 10:10

Viswa Sundhar


It worked for me by editing app/build.gradle

packagingOptions {
    exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
    // or exclude 'META-INF/*'
}

or delete app/build directory

like image 22
Jian Chen Avatar answered Oct 27 '22 11:10

Jian Chen