Olexii Muraviov
Olexii Muraviov

Reputation: 1496

One dependency in several modules

I have an Android application project with several modules.

I'm curious if I will include the same dependency in each module (for example RxJava) will it affect application build time? Or Gralde will compile this dependency only once and will share it with all modules that depend on it?

Thanks in advance!

Upvotes: 1

Views: 75

Answers (1)

TmTron
TmTron

Reputation: 19411

Gradle does not compile RxJava. It will just download the RxJava jar file (which already includes the compiled classes for the RxJava project) from some public repository on the Internet to your local machine.
This jar file is downloaded only once. When the jar already exists on your machine, gradle will just use it.
So you could say, that the same dependency in multiple modules of your gradle build are shared.

But anyway, you should of course only add dependencies that you really need to your modules.

Upvotes: 3

Related Questions