I am currently working on a task where I need to import a library created by someone else in my team. The problem is that there’s a bug in the library if you use constraint layout version 2.0.4 - one of the constraints gets messed up. However, this is solved if you downgrade to 2.0.1.
The problem is that my application uses constraint layout 2.0.4 in its “app” and “common” modules - if I downgrade the dependency to 2.0.1 in these two places, then the screen depending on the library works. If I keep the versions to 2.0.4 in my app and common modules, then the library also inherits 2.0.4 and the screen that depends on the library is buggy.
Is there any way in which I can determine the imported library to ignore my app’s usage of constraint layout 2.0.4 and continue to use its own implementation, which is 2.0.1?
The library is imported in the app module build.gradle file with
There’s also a canary and production version. From what I’ve seen, you can use the exclude keyword, but I’m not sure exactly how. Should the exclude belong to the library, where you would write in the constraint layout to be excluded? Should the exclude belong to the constraint layout, where you would write in the library to be excluded?
I’ve tried both and it doesn’t work. I’m not exactly sure what to write for the “group” or “module” of the exclude statement, either.