重复类 MultiDex$V14.class
Posted
技术标签:
【中文标题】重复类 MultiDex$V14.class【英文标题】:Duplicate class MultiDex$V14.class 【发布时间】:2016-08-25 20:36:34 【问题描述】:我的 android gradle 构建在 ProGuard 阶段失败,MultiDex$V14.class 出现重复类错误(见下文)。我了解什么是重复类,我知道 MultiDex 是什么,但我仍然不明白它是如何重复的。
问题:
-
当然,我看到 multidex.jar 中有一个定义。我如何知道另一个是在哪里定义的?
ProGuard 不应该删除重复条目而不是抱怨它们吗?
底部的“出了什么问题”描述似乎与重复的类无关。是吗?
-
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: can't write resource [.gitkeep] (Duplicate zip entry [DMMPlaybackBitrateSwitching-1.0.jar:.gitkeep])
...
Warning: can't write resource [.gitkeep] (Duplicate zip entry [DMMDigitalMusicLocatorServiceClient-1.0.jar:.gitkeep])
Exception while processing task
java.io.IOException: Can't write [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/android-gradle/intermediates/classes-proguard/fourfireOS/debug/classes.jar] (Can't read [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/tmp/artifacts/multidex.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [multidex.jar:android/support/multidex/MultiDex$V14.class]))
at proguard.OutputWriter.writeOutput(OutputWriter.java:187)
at proguard.OutputWriter.execute(OutputWriter.java:79)
at proguard.ProGuard.writeOutput(ProGuard.java:427)
at proguard.ProGuard.execute(ProGuard.java:175)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Cannot read [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/tmp/artifacts/multidex.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [multidex.jar:android/support/multidex/MultiDex$V14.class])
at proguard.InputReader.readInput(InputReader.java:188)
at proguard.InputReader.readInput(InputReader.java:158)
at proguard.OutputWriter.writeOutput(OutputWriter.java:176)
... 10 more
Caused by: java.io.IOException: Duplicate zip entry [multidex.jar:android/support/multidex/MultiDex$V14.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.JarReader.read(JarReader.java:65)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
at proguard.InputReader.readInput(InputReader.java:184)
... 12 more
:DigitalMusicAndroidAppOne:shrinkFourFireOSDebugMultiDexComponents FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':DigitalMusicAndroidAppOne:shrinkFourFireOSDebugMultiDexComponents'.
> java.io.IOException: Can't read [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/android-gradle/intermediates/classes-proguard/fourfireOS/debug/classes.jar] (Can't process class [com/company/communication/ir/ParcelableIRServiceEndpoint.class] (Unexpected end of ZLIB input stream))
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 47.07 secs
BUILD FAILED
【问题讨论】:
“出了什么问题”引用了ParcelableIRServiceEndpoint
,所以这取决于你在那里做什么
@cricket_007 是的,但这与重复的 MultiDex 类有什么关系?我查看了 ParcelableIRServiceEndpoint。这是一个非常简单的类,位于导入的 jar 中,不包含或定义与 MultiDex 相关的任何内容。
不确定。我只是认为“ZLIB 输入流的意外结束”可能意味着该类中的某些内容
我也不确定,但我认为重复类是根本原因,第二个错误是由第一个错误引起的。
【参考方案1】:
两天后,我在 lib..multidex 1.0.1 中找到了问题,但是依赖项是 1.0.0,所以只需杀死 lib,它现在可以工作了
【讨论】:
以上是关于重复类 MultiDex$V14.class的主要内容,如果未能解决你的问题,请参考以下文章
Kotlin、Java、multidex、Dagger 2、Butterknife 和 Realm:transformClassesWithJarMergingForDebug:重复条目:org/je
Android 使用android-support-multidex解决Dex超出方法数的限制问题
在路径上找不到类“android.support.multidex.MultiDexApplication”:DexPathList