[英]How can I check which Gradle Android plugin version is used in my project?
In my build.gradle file I set the following dependency:在我的 build.gradle 文件中,我设置了以下依赖项:
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
This will automatically adapt to the latest released version (like it's described here ).这将自动适应最新发布的版本(像它的描述在这里)。
How can I check which current release is used in my project?如何检查我的项目中使用的是哪个当前版本?
EDIT 2013-08-08:编辑 2013-08-08:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
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
).显示构建脚本类路径的已解析依赖项不是其他配置的内置操作(可以使用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:仅显示 Android 插件版本的变体:
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.较新版本的 Gradle(3.0+,可能更早版本)支持内置buildEnvironment
任务,该任务显示buildEnvironment
的依赖关系图。
./gradlew buildEnvironment
https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html#sec:listing_buildscript_dependencies https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html#sec:listing_buildscript_dependencies
To determine what revision of the plugin you are using, check the version declaration in the project-level
build.gradle
file.要确定您使用的是哪个版本的插件,请检查项目级build.gradle
文件中的版本声明。
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
In the above example, the Gradle Android plugin version/revision is 1.3.0在上面的例子中,Gradle Android 插件版本/修订版是 1.3.0
try the following code:试试下面的代码:
com.android.builder.Version.ANDROID_GRADLE_PLUGIN_VERSION
This is the easiest one I think.这是我认为最简单的一种。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.