简体   繁体   中英

Library version conflict between app and third party library android

I am using a android library which is of version 4.0.0, The same library which is being used by another third party library is of version 5.0.0. The conflict here is am using both the android library and third party library. The android library which was used in third party library has different version and I was using different version.

Third party uses the higher version, whereas I was using the lower version.

Is there any way to use two different version of same library one version in app and different version in third party lib ?

There are sometimes ways to exclude library dependencies from projects so that you can override which version is used. You must keep in mind, however, that if something has an implementation specific to the lower (or higher) version of the library, then this will not work.

And example of how you can exclude a module from a dependency looks like this:

 dependencies { implementation("some-library") { exclude(group = "com.example.imgtools", module = "native") } }

This example is from Google's documentation here: https://developer.android.com/studio/build/dependencies#exclude_dependencies

In the example, "some-library" would be the third party library you are using and "com.example.imgtools" is the dependency both libraries have that have conflicting versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM