'What are dependencies in android?

  1. What are dependencies ?
  2. Why do we add dependencies ?

I searched a lot but could not find the answers to above questions.



Solution 1:[1]

In Android Studio, dependencies allows us to include external library or local jar files or other library modules in our Android project.

For example: Suppose I want to show some images in ImageView. But I'm using Glide Library to enhance the smoothness of application. So I have to add a dependency in the build.gradle(Module App) as:

compile 'com.github.bumptech.glide:glide:3.7.0'

So Now I can use Glide library :) and show my images.

Note: Glide library is the bumptech's library but still I can use it in my project from 1 line of code of dependency.

Solution 2:[2]

Whenever you add a dependency to your gradle file, it will download the added libraries, and add them to your project so that is available in your project. It makes it easy to manage external libraries in your project.

To study more , visit : https://developer.android.com/studio/build/dependencies.html

Solution 3:[3]

if you want to use external libraries or modules in your android project you have to add the dependancies so that you may be given the authority to use that particular library otherwise that will not be accessible to you inside the project. so, its concluded that: The Gradle build system in Android Studio makes it easy to include external binaries or other library modules to your build as dependencies. The dependencies can be located on your machine or in a remote repository, and any transitive dependencies they declare are automatically included as well for further you can visit this link: https://developer.android.com/studio/build/dependencies

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yogi
Solution 2 Pro Mode
Solution 3