How to manage different support library versions for 3rd party deps with gradle?

前端 未结 4 589
误落风尘
误落风尘 2020-12-12 19:33

I have a bunch of third party libs that I include in my base application. I cannot control the support library those 3rd party modules include. This makes it hard to have t

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 20:11

    You need to specify dependency, with your desired version, that is causing the conflict before the libs that need it. If you do that these lib will use your specified dependency version.

    Example with libs (from warning message) from your screenshot

    dependencies {
        compile 'com.android.support:support-v13:26.0.0'
        compile 'com.android.support:support-compat:26.0.0'
        compile 'com.android.support:animated-vector-drawable:26.0.0'
        compile 'com.test:lib1:1.0' // depends on support-v13:25.0.0
        compile 'com.test:lib2:1.0' // depends on support-v13:25.2.0
        compile 'com.test:lib3:1.0' // depends on support-v13:25.4.0
        compile 'com.test:lib4:1.0' // depends on support-v13:26.0.0
    }
    

    Continue adding dependencies (that show up in the warning from your screenshot) until there is no longer any warning message about different library versions.

提交回复
热议问题