Reputation: 22536
I have following dependency and getting CoordinatorLayout$Behavior
duplicate entry. I have searched so more but did not find any solution.
I am getting
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
where core UI comes in? I think this makes issues. Can anyone know where i need to exclude one of this lib?
I have explore my all lib and having following scene.
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'
}
Upvotes: 16
Views: 21924
Reputation: 22536
I just did it like. It's working now
Solution 1
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'
Solution 2 (NEW)
Migrate your code to AndroidX
Upvotes: 42
Reputation: 37
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:support-v4:27.0.0'
implementation 'com.android.support:design:27.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.support:cardview-v7:27.0.0'
implementation 'com.android.support:recyclerview-v7:27.0.0'
Upvotes: 0
Reputation: 600
Run this to view app dependencies
gradlew -q :app:dependencies > dependencies.txt
It will output a big tree, where:
Output:
+--- 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 (*)
In my case I found that com.android.support:design:26.1.0
was depending on com.android.support:appcompat-v7:26.1.0 -> 27.1.1 (*)
, which resolved to 27.1.1 instead of 26.1.0
Solution
Force version 26.1.0 by declaring in gradle compile ("com.android.support:appcompat-v7:26.1.0") { force = true }
References
Upvotes: 5
Reputation: 2503
Aside of using Project
view -> External Libraries
, I use gradle
command to output the dependencies into a txt file for searching. Use ./gradlew
On Mac and gradlew.bat
on Window.
$ ./gradlew -q :app:dependencies > dependencies.txt
In dependencies.txt
, use "Find" and type "design", for example, and look at all highlighted libraries and their version number. From some SO posts, they suggest to exclude duplicated dependencies. If a dependency is included by another one (for example, com.android.support:cardview-v7
is included by com.firebaseui:firebase-ui-auth
), we can omit that dependency from the app/build.gradle.
I fixed my project by removing these dependencies from my 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'
I keep this one (and upgrade from 27.0.2 to 27.1.0):
implementation 'com.android.support:design:27.1.0'
Add exclude to following dependencies:
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'
}
I got into the lifecycle issue after add/remove dependencies. Another SO post suggest that two different version of library was included. So, I updated the output file in step 1 and check:
+--- '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'
By excluding android.arch.lifecycle:extensions
that solve the compile problem.
Upvotes: 6