3

What is the use of including classpath in dependencies section of buildscript build.gradle(Project). Example :

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } 

classpath 'com.android.tools.build:gradle:1.5.0' what is its purpose / what does it do?

2
  • It is to inform the project that I will be using this dependency. It like importing files into project. Hence, classpath defines the path of the dependency. Commented Jan 12, 2016 at 8:35
  • it use to updates the Android Plugin for Gradle to version 1.5.0. Refer developer.android.com/tools/revisions/gradle-plugin.html Commented Jan 12, 2016 at 8:38

1 Answer 1

3

This is the classpath used by Gradle itself. If you want to extend your build logic with non-standard plugins or other supporting classes they must be found in this classpath.

The mentioned dependency com.android.tools.build:gradle:1.5.0 contains the plugin doing the android specific build stuff.

Sign up to request clarification or add additional context in comments.

1 Comment

And I presume Gradle automatically downloads the package when it sees classpath, and then appends the path of the directory it downloaded to, to the classpath. This is so that Gradle has access to these files when it runs (e.g. plugin files). When using implementation/ api in app/build.gradle, don't these dependencies also get added to the "classpath". So does it make sense to rename classpath to gradleImplementation.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.