問題描述
我是 gradle 新手,有 2 個(gè)問題:
I'm new to gradle and got 2 questions:
gradle本身就是一個(gè)構(gòu)建工具,那為什么腳本中需要Android gradle工具
com.android.tools.build:gradle:0.7.+
呢?
安裝的 gradle 的版本(比如 1.9)和那個(gè) Android gradle 工具的版本之間有什么關(guān)系,比如 classpath 'com.android. 中的 0.7.+.tools.build:gradle:0.7.+'
.如果我將后者的版本更改為 0.8.+,則構(gòu)建會(huì)因找不到插件 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'.
推薦答案
我會(huì)盡量回答你的問題.
I will try to answer your questions.
正如您所說,Gradle 是一個(gè)構(gòu)建工具,但是您在第一個(gè)問題中提到的那一行是指
Gradle Java 插件版本
.Gradle 有用于構(gòu)建 Java 項(xiàng)目的插件.這些插件在通用構(gòu)建工具 Gradle 的基礎(chǔ)上擴(kuò)展,并且可能提供附加功能.您可以在這里閱讀更多關(guān)于 Gradle 插件的信息.
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.
更改插件版本時(shí)構(gòu)建失敗的原因很簡單,插件版本 0.8 不存在.Gradle 版本和插件版本之間存在關(guān)系,開發(fā)人員必須維護(hù)它.您只能使用已發(fā)布且與 Gradle 版本兼容的插件版本.我希望第一個(gè)問題的答案無論如何都能回答這個(gè)問題.
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.
這篇關(guān)于gradle 版本和 gradle build tool 版本的關(guān)系的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!