I am working on a multi module Android project. One of the modules which was written previously used Paging library version-2, now I am trying to use the new paging v3 library in another module, but I am getting this error.
Duplicate class androidx.paging.LivePagedListKt found in modules jetified-paging-runtime-ktx-2.1.2-runtime.jar (androidx.paging:paging-runtime-ktx:2.1.2) and paging-runtime-3.0.0-alpha03-runtime.jar (androidx.paging:paging-runtime:3.0.0-alpha03)
The module hierarchy is this way:
app:
/ \
module-A module-B
(uses v2) (uses v3)
I have added dependencies of module A and module B in the app module build.gradle like this
implementation project(path: ':module-A')
implementation project(path: ':module-B')
Is there any way we can use different versions of the same library in the same project, provided that the different versions are used in separate modules.
Solutions tried so far:
I looked through similar answers and added this line in app level build.gradle file
configurations {
runtime.exclude group: 'androidx.paging', module: 'paging-runtime'
}
but still getting the same error.