What is the difference between application dependency and module dependency / module?

When using some third-party libraries, I add a dependency to my build.gradle module.

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

Or I add a plugin

  apply plugin: 'com.neenbedankt.android-apt' 

In some other cases, the library requires adding a dependency to my application's build.gradle file.

  classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 

What is the difference between these dependencies and plugins?
Why can't they be installed in a single build.gradle file?

All suggestions are welcome, I am having problems finding information about this.

+3
source share
1 answer

Three things. Gradle, module dependency, assembly dependency, which is placed in the classpath of the build tool.

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

Dependency library compiled with your code . The next line makes your module depend on the Android AppCompat V7 library. For the most part, you do a Maven or Jcenter search for these.

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

The classpath parameter is required for Gradle , not for your application. For example, this allows you to include Gradle Build Tools for Android in the classpath and allows Gradle to create applications.

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

Why can't all of them be in the same build.gradle file?

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

+6
source

Source: https://habr.com/ru/post/1262756/


All Articles