Android Studio: Error:Execution failed for task ':app:dexDebug',我遇到这个问题,更具体的如下:
Caused by: com.android.build.api.transform.TransformException: Error while generating the main dex list.
at com.android.build.gradle.internal.transforms.D8MainDexListTransform.transform(D8MainDexListTransform.kt:127)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
... 49 more
Caused by: com.android.builder.multidex.D8MainDexList$MainDexListException: com.android.tools.r8.errors.CompilationError: Program type already present: android.support.annotation.IntegerRes
at com.android.builder.multidex.D8MainDexList.generate(D8MainDexList.java:87)
at com.android.build.gradle.internal.transforms.D8MainDexListTransform.transform(D8MainDexListTransform.kt:114)
... 52 more
搜索了谷歌和百度,都没人遇到类似的问题,后来偶尔想到是不是有什么包重复了,找了一下libs下的目录,竟然真的发现android-support-v4.jar这里有,然后build.gradle也有定义,我试着删除掉,重新运行好了,提供别人一个思路,遇到这种multidex的错误,有可能是什么包重复了: