gradle 版本和 gradle build tool 版本的关系

relation between gradle version and gradle build tool version(gradle 版本和 gradle build tool 版本的关系)
本文介绍了gradle 版本和 gradle build tool 版本的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我是 gradle 新手,有 2 个问题:

I'm new to gradle and got 2 questions:

  1. gradle本身就是一个构建工具,那为什么脚本中需要Android gradle工具com.android.tools.build:gradle:0.7.+呢?

安装的 gradle 的版本(比如 1.9)和那个 Android gradle 工具的版本之间有什么关系,比如 classpath 'com.android. 中的 0.7.+.tools.build:gradle:0.7.+'.如果我将后者的版本更改为 0.8.+,则构建会因找不到插件 AppPlugin"而失败.

What is the relation between the version of gradle installed (say 1.9) and the version of that Android gradle tool, like 0.7.+ in classpath 'com.android.tools.build:gradle:0.7.+'. If I changed the latter's version to 0.8.+ then the build fails on 'could not find plugin AppPlugin'.

推荐答案

我会尽量回答你的问题.

I will try to answer your questions.

  1. 正如您所说,Gradle 是一个构建工具,但是您在第一个问题中提到的那一行是指 Gradle Java 插件版本.Gradle 有用于构建 Java 项目的插件.这些插件在通用构建工具 Gradle 的基础上扩展,并且可能提供附加功能.您可以在这里阅读更多关于 Gradle 插件的信息.

  1. As you said, Gradle is a build tool, but the line you have mentioned in your first question is referring to Gradle Java plugin version. Gradle has plugin for building Java projects. These plugins extend upon the general purpose build tool Gradle is, and may provide additional features. You can read more about the Gradle plugins here.

更改插件版本时构建失败的原因很简单,插件版本 0.8 不存在.Gradle 版本和插件版本之间存在关系,开发人员必须维护它.您只能使用已发布且与 Gradle 版本兼容的插件版本.我希望第一个问题的答案无论如何都能回答这个问题.

The reason your build fails when you change the plugin version is simple, the plugin version 0.8 is not there. There is a relationship between Gradle version and the plugin version and a developer has to maintain that. You can only use a plugin version which has been released and is compatible with the Gradle version. I hope the answer to first question answers this anyways.

这篇关于gradle 版本和 gradle build tool 版本的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)