重复的zip条目[classes.jar:android / support / design / widget / CoordinatorLayout $ Behavior.class]

时间:2018-03-01 07:38:04

标签: android android-studio android-support-library

我有以下依赖项并获得CoordinatorLayout$Behavior重复条目。我搜索了这么多,但没有找到任何解决方案。

我正在

Caused by: java.io.IOException: Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
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)
... 50 more

核心UI进来的地方?我认为这会产生问题。任何人都可以知道我需要在哪里排除这个lib吗?

我已经探索了我的所有lib并拥有以下场景。

enter image description here

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//    compile('com.mikepenz:materialdrawer:5.8.0@aar') {
//        transitive = true
//    }
compile 'com.android.support:multidex:1.0.2'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:support-v4:27.0.0'
compile 'com.android.support:recyclerview-v7:27.0.0'
compile 'com.android.support:design:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'com.google.android.gms:play-services-gcm:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile 'com.pnikosis:materialish-progress:1.7'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.github.rey5137:material:1.2.4'
compile 'org.apache.commons:commons-lang3:3.6'
compile 'com.afollestad.material-dialogs:core:0.9.5.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'com.github.travijuu:numberpicker:1.0.7'
compile 'com.github.carlosmuvi:SegmentedProgressBar:0.6.0'
compile 'com.nex3z:notification-badge:0.3.0'
compile 'com.bogdwellers:pinchtozoom:0.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
compile 'com.aurelhubert:ahbottomnavigation:2.1.0'
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile files('libs/PGSDK_V2.1.jar')
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.race604.waveloading:library:1.1.1'
compile 'com.karumi:dexter:4.2.0'
compile 'com.msg91.sendotp.library:library:3.1'
}

4 个答案:

答案 0 :(得分:31)

我就是这么做的。它现在正在工作

compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:support-v4:27.1.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'

答案 1 :(得分:5)

除了使用Project视图 - > External Libraries,我使用gradle命令将依赖项输出到txt文件中进行搜索。在Mac上使用./gradlew,在窗口上使用gradlew.bat

$ ./gradlew -q :app:dependencies > dependencies.txt

dependencies.txt中,使用"查找"例如,键入" design"并查看所有突出显示的库及其版本号。从一些SO帖子中,他们建议排除重复的依赖关系。如果另一个包含依赖项(例如,com.android.support:cardview-v7包含com.firebaseui:firebase-ui-auth),我们可以从app / build.gradle中省略该依赖项。

我通过从gradle中删除这些依赖项来修复我的项目:

implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-vector-drawable:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'

我保留了这个(并从27.0.2升级到27.1.0):

implementation 'com.android.support:design:27.1.0'

将排除添加到以下依赖项:

implementation 'com.firebaseui:firebase-ui-auth:3.1.2', {
    exclude group: 'android.arch.lifecycle', module: 'extensions'
    exclude group: 'com.android.support', module: 'design'
}
implementation 'com.romandanylyk:pageindicatorview:1.0.0', {
    exclude group: 'com.android.support', module: 'support-core-ui'
}

添加/删除依赖项后,我遇到了生命周期问题。另一篇SO帖子表明包含了两个不同版本的库。因此,我在步骤1中更新了输出文件并检查:

+--- 'com.google.firebase:firebase-core:11.8.0'
|    +--- 'android.arch.lifecycle:runtime:1.1.0' 

+--- 'com.firebaseui:firebase-ui-auth:3.1.2'
|    +--- 'android.arch.lifecycle:extensions:1.0.0'

排除解决编译问题的android.arch.lifecycle:extensions

答案 2 :(得分:5)

运行此命令以查看应用程序依赖项

gradlew -q :app:dependencies > dependencies.txt

它将输出一棵大树,其中:

  • (*)用于指示树中其他位置描述了特定的依赖关系
  • -> (箭头)用于指出版本冲突中 wins 的依赖项。默认情况下,gradle选择最新版本。

输出:

+--- com.android.support:design:26.1.0
|    +--- com.android.support:support-v4:26.1.0 (*)
|    +--- com.android.support:appcompat-v7:26.1.0 -> 27.1.1 (*)
|    +--- com.android.support:recyclerview-v7:26.1.0 (*)
|    \--- com.android.support:transition:26.1.0
|         +--- com.android.support:support-annotations:26.1.0 -> 27.1.1
|         \--- com.android.support:support-v4:26.1.0 (*)

在我的情况下,我发现com.android.support:design:26.1.0取决于com.android.support:appcompat-v7:26.1.0 -> 27.1.1 (*),它解析为27.1.1而不是26.1.0

解决方案 通过在gradle compile ("com.android.support:appcompat-v7:26.1.0") { force = true }中声明来强制版本26.1.0

参考

答案 3 :(得分:0)

class DispatchPlan(models.Model):

    owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='dispatch_quizzes')
    comments = models.TextField(max_length=256)
    truck_type = models.ForeignKey(truck_type, on_delete=models.CASCADE, related_name='dispatch_type')
    truck_name = models.ForeignKey(truck_name, on_delete=models.CASCADE, related_name='dispatch_name')

    items = models.ForeignKey(ItemBatch, on_delete=models.CASCADE, related_name='items')

class ItemBatch(models.Model):
    ttypes = (('Open', 'Open'), ('Container', 'Container'), ('Trailer', 'Trailer'), ('All', 'All'))
    uploaded_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='uploaded_by')
    name = models.CharField(max_length=100)
    pid = models.IntegerField(blank=True)
    quantity = models.IntegerField(blank=True)
    length = models.FloatField(blank=True)
    width = models.FloatField(blank=True)
    height = models.FloatField(blank=True)
    volume = models.FloatField(blank=True)
    weight = models.FloatField(blank=True)
    truck_type = models.CharField(max_length=255, default=0, choices=ttypes)
    origin = models.CharField(max_length=100, blank=True)
    date = models.DateTimeField(blank=True, null=True, default=now)
    destination = models.CharField(max_length=100, blank=True)
    time = models.DateTimeField(max_length=100, blank=True, default=now)
    rtd = models.BooleanField(default=False)  # ready to dispatch checkbox
    is_dispatched = models.BooleanField(default=False)  # item is dispatched or not