How can I check which Gradle Android plugin version is used in my project?

强颜欢笑 提交于 2019-11-29 05:29:53
Peter Niederwieser

Showing the resolved dependencies for the build script class path isn't a built-in operation as for other configurations (which can be inspected with gradle dependencies). However, you can write a task to do so. For example:

task showClasspath  {
    doLast {
        buildscript.configurations.classpath.each { println it.name }
    }
}

A variation that just shows the Android plugin version:

task showVersion {
    doLast {
        println buildscript.configurations.classpath.resolvedConfiguration.firstLevelModuleDependencies.moduleVersion
    }
}

Newer versions of Gradle (3.0+, and possibly earlier) support a built-in buildEnvironment task that shows the dependency graph for buildscript.

./gradlew buildEnvironment

https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html#sec:listing_buildscript_dependencies

Paul

To determine what revision of the plugin you are using, check the version declaration in the project-level build.gradle file.

Source

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
}

In the above example, the Gradle Android plugin version/revision is 1.3.0

xiaobin yáng

try the following code:

com.android.builder.Version.ANDROID_GRADLE_PLUGIN_VERSION

This is the easiest one I think.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!