android - 生成签名 APK 时出现 "androidx.legacy_legacy-support-core-utils.version collided"错误

标签 android android-studio build.gradle signed-apk

在尝试生成签名 APK 时,它显示以下错误消息。

条目名称 'META-INF/androidx.legacy_legacy-support-core-utils.version' 冲突

以前它可以正常工作几年。此外,我已经检查了另一台具有相同 android studio 和相同 gradle 版本的 PC,它在该 PC 中正常工作。我遇到这个问题,特别是一台 PC 本身,为什么?我在下面附上了 build.gradle。

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'

}

请任何人帮助解决这个问题。我在哪里错过了什么?

最佳答案

我找到了问题的根源。它在 输出.json .这是罪魁祸首。该文件由于某些 Activity 而损坏。我们必须从 Signed APK 生成的目标文件夹中删除该文件。它解决了这个问题。

关于android - 生成签名 APK 时出现 "androidx.legacy_legacy-support-core-utils.version collided"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62384084/

相关文章:

android - Jetpack AndroidX 测试 "Write Once, Run Everywhere"- 但运行 Everywhere 的最佳方式是什么?

java - Android Studio - 如何更改图像资源?

gradle - 如何使用 Gradle 构建仅包含类子集的特殊 JAR?

android - 如何避免将 Android 应用程序拆分为模块的 Assets 冗余?

android - HttpUrlConnection setConnectTimeout 不起作用?

java - IntelliJ Idea android application jakarta-commons-collections 多个dex文件定义

java - Android Studio : onTouchEvent either doesn't run or can't update variables

android - Gradle 访问同一文件中 `apply from: ' '` 的属性

用于在 Android 上安装 APK 的 Java 应用程序

Android Studio 1.0 Gradle 错误与 getConfiguration()