Error : Program type already present: android.support.design.widget.CoordinatorLayout$Behavior

前端 未结 22 1419
不知归路
不知归路 2020-11-27 14:04

I am getting the following error while building the project. haven\'t used CoordinatorLayout in this project. just added as a dependency in build.gradle :

I am usin

相关标签:
22条回答
  • 2020-11-27 14:06

    I had this problem too; and i resolved that in this way:

    configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.1'
            }
        }
      }
    }
    

    be careful my min SDk was 26 , you have to change it with yours!

    0 讨论(0)
  • 2020-11-27 14:06

    If any of the answers mentioned here doesn't work then go to File > Invalidate Catches/Restart

    0 讨论(0)
  • 2020-11-27 14:07

    Personally, I add the following line to my app/build.gradle:

    implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
    

    With this syntax, version is dynamical.

    0 讨论(0)
  • 2020-11-27 14:10

    Make sure these two are the same version in your app level build.gradle file

        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support:design:27.1.1'
    

    I think that should solve the problem

    0 讨论(0)
  • 2020-11-27 14:10

    Go to the directory where you put additional libraries and delete duplicated libraries.

    0 讨论(0)
  • 2020-11-27 14:11

    "Program type already exists" Remove your /build directory contents, it has some Dex(?) problem with the generated binary files. Got to those answers just like you, they helped to resolve this problem but created many others. Build contents removal works for all.

    0 讨论(0)
提交回复
热议问题