Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

relation between gradle version and gradle build tool version

I'm new to gradle and got 2 questions:

  1. gradle itself is a build tool, so why is the need for Android gradle tool com.android.tools.build:gradle:0.7.+ in the script?

  2. 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'.

like image 657
EyeQ Tech Avatar asked Feb 15 '14 02:02

EyeQ Tech


People also ask

How do I find Gradle version in build Gradle?

In Android Studio, go to File > Project Structure. Then select the "project" tab on the left. Your Gradle version will be displayed here.

How do I find Gradle build tools version?

For the compileSdkVersion you can goto Tools > Android > SDK Manager . This will pull up a window that will allow you to manage your compileSdkVersion and your buildToolsVersion .

What is Gradle version?

Android Gradle plugin. 3.6.4. 7.0.4. For example, the Kotlin Gradle plugin and the kotlin-multiplatform plugin 1.7.20 require the minimum Gradle version of 6.7.1 for your project to compile. In turn, the maximum fully supported version is 7.1.1.


2 Answers

1) Gradle is a build tool, but it requires specific plugin to work. Android Tool Team is releasing the Android plugin for Gradle.

com.android.tools.build:gradle:0.6.+ 
com.android.tools.build:gradle:0.7.+ 
com.android.tools.build:gradle:0.8.+ 

Here you can find the repo: https://android.googlesource.com/platform/tools/base/

The current dev branch is idea133. Otherwise you can check gradle_0.8/gradle_0.7 branches.

2) There is a relation between gradle-plugin and the gradle version. For example

com.android.tools.build:gradle:0.6.+  -> gradle 1.8
com.android.tools.build:gradle:0.7.+  -> gradle 1.9
com.android.tools.build:gradle:0.8.+  -> gradle 1.9/1.10

You can find gradle version used in your project in the file gradle/wrapper/gradle-wrapper.properties

Also there is a relation between gradle-plugin and the IDE version. For example:

Android Studio 0.3.x -> gradle-plugin 0.6
Android Studio 0.4.x -> gradle-plugin 0.7
Android Studio 0.4.3+ -> gradle-plugin 0.8

For updated news you can check this link: http://tools.android.com/recent

You can also check this updated post:

Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1

If you change your plugin version, check compatibility, and then click sync project with your gradle files.It will download a new plugin version if you need it.

like image 107
Gabriele Mariotti Avatar answered Oct 23 '22 18:10

Gabriele Mariotti


I will try to answer your questions.

  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.

  2. 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.

like image 24
Incognito Avatar answered Oct 23 '22 18:10

Incognito