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

构建APK时遇重复类错误:AsyncListUtil.class重复条目

Fixing Jar Merging Duplicate Entry Error (AsyncListUtil.class) When Building APK

Hey, I’ve run into this exact dependency conflict issue countless times—your build is failing because the android/support/v7/util/AsyncListUtil.class is being included multiple times by different libraries in your project. Let’s walk through the steps to resolve this:

First, Understand the Root Cause

Looking at your dependency list, the problem likely stems from:

  • Third-party libraries (like FirebaseUI or Facebook SDK) pulling in their own versions of Android Support libraries, which clash with the 26.0.1 versions you’ve explicitly declared.
  • The full play-services dependency (com.google.android.gms:play-services:11.0.4) which includes dozens of unused modules, increasing the chance of version conflicts.

Step-by-Step Solutions

1. Find Exactly Which Library Is Causing the Duplicate

Run this Gradle command to generate a full dependency tree—it will show you every library’s dependencies, so you can spot where the duplicate AsyncListUtil is coming from:

./gradlew app:dependencies

Search the output for android/support/v7/util/AsyncListUtil to pinpoint the conflicting library.

2. Exclude Conflicting Support Library Modules

Once you’ve found the culprit, modify its dependency declaration to exclude the duplicate Support module. For example, if FirebaseUI is pulling in an older support-v7 version, update its line to:

compile('com.firebaseui:firebase-ui-auth:2.3.0') {
    exclude group: 'com.android.support', module: 'support-v7'
}

Repeat this for any other libraries showing the duplicate dependency.

3. Replace Full Play Services with Specific Modules

You’re currently using the full play-services package, which is unnecessary (and risky for conflicts). Since you’ve already added play-services-ads and play-services-location, delete the full package line:

// Remove this line—it's pulling in 100+ unused modules
// compile 'com.google.android.gms:play-services:11.0.4'

4. Force All Dependencies to Use Your Support Library Version

To prevent future version mismatches, add this to your root project’s build.gradle (not the app module’s) to force every dependency to use your declared 26.0.1 Support versions:

allprojects {
    repositories {
        // Keep your existing repo config here (google(), jcenter(), etc.)
    }
    configurations.all {
        resolutionStrategy {
            force 'com.android.support:appcompat-v7:26.0.1'
            force 'com.android.support:support-v4:26.0.1'
            force 'com.android.support:design:26.0.1'
            force 'com.android.support:customtabs:26.0.1'
        }
    }
}

5. Clean and Rebuild

Finally, clear your Gradle cache and rebuild the project to apply all changes:

./gradlew clean
./gradlew assembleDebug

These steps should eliminate the duplicate class error and let you generate your APK successfully.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 03:28:53