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

后端 未结 4 1061
灰色年华
灰色年华 2020-12-17 08:40

In my build.gradle file I set the following dependency:

dependencies {
    classpath \'com.android.tools.build:gradle:0.5.+\'
} 

This will au

相关标签:
4条回答
  • 2020-12-17 08:59

    try the following code:

    com.android.builder.Version.ANDROID_GRADLE_PLUGIN_VERSION
    

    This is the easiest one I think.

    0 讨论(0)
  • 2020-12-17 09:02

    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

    0 讨论(0)
  • 2020-12-17 09:17

    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
        }
    }
    
    0 讨论(0)
  • 2020-12-17 09:20

    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

    0 讨论(0)
提交回复
热议问题