You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

生成签名APK遇重复条目错误,请求技术排查解决

Fixing "Duplicate entry: android/support/design/widget/CoordinatorLayout$1.class" Error When Generating Signed APK

Hey, I’ve dealt with this exact duplicate entry issue multiple times, so let’s break down the most reliable fixes to get you past this:

  • Track down duplicate dependencies first
    Run this command in your project root to generate a full dependency tree—it’ll show you exactly which libraries are pulling in duplicate copies of the support design library:

    # For macOS/Linux
    ./gradlew app:dependencies
    
    # For Windows
    gradlew.bat app:dependencies
    

    Look for entries of com.android.support:design that come from more than one source (e.g., your direct dependency plus a third-party library). Once you spot the duplicate, exclude the extra one from the third-party dependency like this:

    implementation('com.example.third-party:library:1.2.3') {
        exclude group: 'com.android.support', module: 'design'
    }
    
  • Unify all support library versions
    Mismatched versions of Android Support libraries (like appcompat-v7, design, recyclerview-v7) are a super common cause of this error. Make sure every support library in your dependencies block uses the exact same version number.
    To make this easier, define a version variable in your root build.gradle:

    ext {
        supportLibVersion = '28.0.0' // Use the latest stable version you need
    }
    

    Then reference it in your app module’s build.gradle:

    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"
    implementation "com.android.support:recyclerview-v7:$supportLibVersion"
    
  • Clean up caches and rebuild
    Gradle caches can sometimes hold onto old, conflicting files. Try these steps:

    1. Go to Build > Clean Project in Android Studio
    2. Then run Build > Rebuild Project
    3. If that doesn’t work, manually delete the .gradle folder (in your project root and app module) and the build folders, then re-sync your Gradle project.
  • Check for AndroidX/Support Library conflicts
    If you’ve started migrating to AndroidX, you can’t mix old Support Libraries with AndroidX dependencies. Check your gradle.properties file:

    android.useAndroidX=true
    android.enableJetifier=true
    

    If these lines are present, replace all old Support Library dependencies with their AndroidX equivalents (e.g., use com.google.android.material:material:1.5.0 instead of com.android.support:design). If you haven’t migrated, make sure none of your dependencies are pulling in AndroidX libraries.

If none of these fixes work, share your full build.gradle code (especially the dependencies section) and I can help you pinpoint the exact conflict.

内容的提问来源于stack exchange,提问作者Shubham Sejpal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 04:12:47