What is the difference between an app dependency and a module dependency/plugin?

Three things. There’s Gradle plugins, module dependencies, and build dependencies which are placed on the classpath of the build tool (Gradle daemon itself).

A plugin is how Gradle knows what tasks to use. There are many plugins. For more info, see Gradle – Plugin Documentation

A dependency is a library that is compiled with your code. The following line makes your module depend on the Android AppCompat V7 library. For the most part, you search Maven for these.

compile 'com.android.support:appcompat-v7:24.1.1'

The classpath setting is needed for Gradle, not your app. For example, this allows this includes the Gradle Build Tools for Android into the classpath, and allows Gradle to build apps.

classpath 'com.android.tools.build:gradle:2.1.2'

Why can’t they all be in one build.gradle file?

They probably can be. It is simply more modular to not.

Leave a Comment