【问题标题】:Problem "Entry name 'META-INF/android.support.design_material.version' collided" Android studio问题“条目名称'META-INF/android.support.design_material.version'碰撞”Android工作室
【发布时间】:2021-08-27 16:53:59
【问题描述】:

我刚刚复制了我的项目,(我希望有 2 个不同的单独应用程序)。我为第二个更改了包名称和 applicationId,它在模拟器上完美运行,但是当我尝试生成已签名的 apk 时出现此错误:

Entry name 'META-INF/android.support.design_material.version' collided

虽然我可以完美地为我的第一个应用程序做到这一点。

我多次尝试重建和清理项目,但没有任何效果。

这是我的 app/build.gradle:

apply plugin: 'com.android.application'

android {


compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

compileSdkVersion 30

defaultConfig {
    applicationId "com.example.apptest"
    minSdkVersion 19
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

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

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.android.volley:volley:1.1.1'
    //noinspection GradleCompatible
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation "androidx.cardview:cardview:1.0.0"
    // https://mvnrepository.com/artifact/com.google.guava/guava
    implementation group: 'com.google.guava', name: 'guava', version: '30.1-jre'
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    android.defaultConfig.vectorDrawables.useSupportLibrary = true
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation "androidx.recyclerview:recyclerview:1.2.0"
    implementation 'com.github.danylovolokh:LondonEyeLayoutManager:1fb6469521'
    implementation 'com.github.leochuan:ViewPagerLayoutManager:v2.0.22'
    implementation 'com.squareup.okhttp3:okhttp:4.2.0'
    implementation 'com.github.rtoshiro:FullscreenVideoView:1.1.2'
    implementation 'androidx.multidex:multidex:2.0.1'


}

如果还有什么我需要放在这里的,请告诉我。 请帮助我,告诉我我做错了什么以及我应该怎么做。 谢谢。

PS:两个应用都有不同的键。 PS:我也尝试删除现有的 APK。没用。

【问题讨论】:

    标签: java android android-studio build apk


    【解决方案1】:

    进行清理和重建项目:

    Menu -> Build -> Clean project
    File -> Invalidate Caches / Restart
    Build —> Rebuild Project
    

    重建项目应该可以解决它。但是由于它无法解决您的问题,请查看应用程序的输出目录中是否有应用程序文件。如果是,请删除或重命名它。似乎android sdk由于某种原因未能覆盖它。或者,您可以从 app 文件夹中完全删除 debug 和 release 文件夹,然后重新启动 IDE。

    如果以上方法都不能解决您的问题,那么在您的应用构建 Gradle 中添加以下内容,然后清理,重新构建您的项目。

    packaging options{ exclude 'META-INF/android.support.design_material.version' }
    

    【讨论】:

      猜你喜欢
      • 2020-09-28
      • 2021-04-16
      • 1970-01-01
      • 1970-01-01
      • 2019-12-20
      • 1970-01-01
      • 1970-01-01
      • 2013-02-25
      • 1970-01-01
      相关资源
      最近更新 更多