# 任务 ':app:transformClassesWithJarMergingForDebug' 执行失败。> com.android.build.api.transform.TransformException: java.util.zip.ZipException: 重复条目：com/google/common/collect/ImmutableList.class

- **ID:** `android/gradle-task-assemble-debug-failed-jetifier`
- **领域:** android
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

多个依赖中发现重复类，通常是由于 Jetifier 同时转换了支持库和 AndroidX，或者两个库提供了相同的类。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Android Gradle Plugin 8.1 | active | — | — |
| Gradle 8.2 | active | — | — |
| Jetifier 1.0.0-beta10 | active | — | — |
| Android Studio Hedgehog 2023.1.1 | active | — | — |

## 解决方案

1. ```
   Run `./gradlew :app:dependencies --configuration debugCompileClasspath` to identify which libraries bring the duplicate class. Then exclude the transitive dependency in build.gradle: implementation('com.example:library:1.0') { exclude group: 'com.google.guava', module: 'guava' }
   ```
2. ```
   Upgrade all dependencies to their AndroidX versions and disable Jetifier in gradle.properties: android.jetifier.enabled=false
   ```
3. ```
   Use the `com.google.guava:guava:30.1.1-android` variant which avoids conflicts with other Android libraries.
   ```

## 无效尝试

- **** — Disabling Jetifier entirely may cause other libraries to break if they still depend on support libraries. (70% 失败率)
- **** — Adding an exclude statement in packagingOptions for the duplicate class often masks the root cause and may remove needed functionality. (65% 失败率)
- **** — Using a newer version of the dependency without checking its transitive dependencies may introduce more duplicates. (60% 失败率)
