⚠️
IMPORTANT PSA FOR MULTIPLATFORM/ANDROID LIBRARY AUTHORS ⚠️
TL;DR: Publishing multiplatform libraries with Android Gradle Plugin 7.1.0-alpha13 (or higher) will require Kotlin Gradle Plugin 1.6.10 (or higher).
# What happened
We detected a recent incompatibility between newer pre-release Android Gradle Plugin versions and the current Kotlin Multiplatform Gradle Plugin.
To be more precise: Starting from AGP version 7.1.0-alpha13, Android related Gradle configurations will set an internal attribute that will unfortunately be copied by Kotlin during the publication process of a library.
This Gradle attribute will effectively tell Gradle, that the Library is only compatible with builds using the exact same AGP version. Obviously, this is not correct and not desirable.
Libraries published with this attribute will therefore be
almost “un-consumable” by users.
____________
# Consequences for you (the Library author)
When upgrading AGP to 7.1.0-alpha13 (or higher), make sure you are using Kotlin Gradle Plugin 1.6.10 (or higher) to create proper publications.
When using AGP 7.1.0-alpha12 (or lower), this does not affect you.
____________
# Consequences for you (Application Developer)
None, enjoy!
____________
# Appendix
We know, that issues like this are uncomfortable for users. Integrating Android into multiplatform is hard and this is not the first time we suffered from Android+Multiplatform issues.
We (the Kotlin, more precise the Kotlin Multiplatform Core, Team) are aware of this and are actively working together with Google (more precise the AGP team) to find better ways of working together/integrating.
Some very ambiguous plans were made recently and we started working on it already.
____________
The workaround on the Kotlin Gradle Plugin side can be tracked here:
https://youtrack.jetbrains.com/issue/KT-49798
This is currently in review and is planned to be shipped in 1.6.10
Thanks folks and I hope you’ll have a more enjoyable Friday than I do 😁 K