Gradle plugins are powerful – you can integrate custom logic into the build process to make it fit your needs. In the Android world, most Gradle plugins will have to interact with the Android Gradle plugin (AGP) in some way or another. It can be very easy to couple the code of your plugin to a specific version of AGP, leading to failures if people upgrade or use older versions. This is especially problematic if you want to offer your plugin to a broader audience.
In this talk, we’re going to showcase different techniques we can use to to write Gradle plugins that are compatible with multiple versions of the Android Gradle plugin. We’re going to explore the trade-offs that come with different approaches. We’re also going highlight how we can test our plugins against multiple AGP versions and we’re going to discuss when we should drop compatibility with old versions.
After this talk, you’re going to know several ways of writing backwards-compatible Gradle plugins that you can apply to your projects, whether you’re working on commercial, open-source or internal Gradle plugins.