After updating to the latest gradle, I get a weird error when building the project:
[:feature_x, :feature_y] all package the same library [com.github.PhilJay:MPAndroidChart].
I have indeed added this library in both features. They are set as a dependency like:
api "com.github.PhilJay:MPAndroidChart:$rootProject.MPAndroidChart"
What is wrong with this?
As of 2018-10, this is expected behavior, according to this issue in Google's issue tracker:
Yes, multiple non-base features depending on the same library is currently not supported because both of the features will package the library, but there's no guarantee that they'll package the same version of the library, which can lead to crashes at runtime. We opted to fail the build in these cases to prevent unexpected behavior at runtime.
Unfortunately, adding the library as a dependency to the base module is the suggested workaround for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With