Mehraj Malik
Mehraj Malik

Reputation: 15874

What happens when we add DEPENDENCY in android studio

I am Java Developer and just started working on Android. we add Dependencies in android studio,so what happens when we did that? A new file is downloaded or something different happens in android studio?.

I mean in some other language we add external libraries (for eg jar file in java,so that is added physically in our project,we can see that).

Please explain and thanks

Upvotes: 1

Views: 2382

Answers (2)

skynet
skynet

Reputation: 726

As quoted in Gradle's official Site : Gradle allows you to tell it what the dependencies of your project are, so that it can take care of finding these dependencies, and making them available in your build. The dependencies might need to be downloaded from a remote Maven or Ivy repository, or located in a local directory, or may need to be built by another project in the same multi-project build.

So, whenever you add a dependency to your gradle file, it will download those libraries, and resolves it so that is available in your project. It makes it easy to manage external libraries for your project, rather than adding jar files manually.

You can go over the gradle's official website for more detailed information

Gradle Official Site

Upvotes: 1

SoroushA
SoroushA

Reputation: 2121

It is exactly the same thing. When you add a dependency from a repository (e.g. Maven), the library file gets downloaded and added to your project as soon as you sync your project.

EDIT:

In order to see the links to the downloaded files, you can use the -i option for a gradle build to see the info:

gradlew -i --refresh-dependencies assembledebug

Gradle log

These files are then downloaded into :

\app\build\intermediates\pre-dexed

Upvotes: 1

Related Questions