Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]

后端 未结 4 498
醉话见心
醉话见心 2020-12-01 16:29

I have following dependency and getting CoordinatorLayout$Behavior duplicate entry. I have searched so more but did not find any solution.

I am getting

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 16:50

    Run this to view app dependencies

    gradlew -q :app:dependencies > dependencies.txt
    

    It will output a big tree, where:

    • (*) is used to indicate that particular dependency is described somewhere else in the tree
    • -> (arrow) is used to point the dependency that wins in version conflict. By default, gradle chooses the newest version.

    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

    • How to understand the output of command 'gradle dependencies'?
    • Gradle: how to display where a dependency conflict arises
    • Understanding and dominating gradle dependencies

提交回复
热议问题