How can I determine the version of the Android Gradle plugin used in my own Gradle plugin?

Context

I am writing a Gradle plugin for Android projects. My plugin relies on some methods from the Android Gradle plugin, but the exact calls I need to use have changed as the Android Gradle plugin develops (for example, the methods I need are different from v2.1.2 vs v.2.2.2 the Android Gradle plugin ) I want to get the version of the Android Gradle plugin programmatically from my own plugin, and then call the appropriate methods for this version.

Question

How can I access the version of the Android Gradle plugin programmatically from my own Gradle plugin? Invokes

project.rootProject.buildscript.getDependencies()

right starting point?

+4
1

Gradle, Project.getGradle(), gradle.gradleVersion, Gradle!

, !

-1

Source: https://habr.com/ru/post/1666978/


All Articles