gradle dependency error in android

后端 未结 3 556
别跟我提以往
别跟我提以往 2020-12-03 17:43

In the following build.gradle, I added the configuration section to avoid double inclusion of support libraries. Support libraries are used in the main project and in the de

相关标签:
3条回答
  • 2020-12-03 18:15

    Found a solution to this:

    1. Removed the config section in the build.gradle that excludes support-v4

    2. It turns out that .aar files are basically a zip, so removed the support-v4 jar from the dependency .aar library (using 7-zip). And now, I don't get the top-level exception and at the same time able to use recyclerview-v7.

    If you are using dependency projects instead of .aar files, try removing the support-v4.jar files in the dependency projects before compiling.

    Shouldn't the gradle build tool be intelligent enough to exclude the duplicate packages rather than having the users go thru this kind of workarounds and headaches?

    0 讨论(0)
  • 2020-12-03 18:25

    I fixed that adding:

    compile ('com.facebook.android:facebook-android-sdk:3.22.0@aar'){
        exclude module: 'support-v4'
    }
    
    0 讨论(0)
  • 2020-12-03 18:30

    If you're having a dependency conflict with the v4 support library, you can just exclude it from one of the libraries via the gradle script:

    compile ('com.android.support:recyclerview-v7:+') {
        exclude module: 'support-v4'
    }
    
    0 讨论(0)
提交回复
热议问题