Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does gradle download a fresh copy of dependencies for each new project?

I have been endlessly searching the internet and reviewing some questions here for the entire past week since I decided to move to Android Studio

I really dont understand why you have to be online at least once in order to build a project in Android Studio What was so special in Eclipse that it was able to do all the compiling offline and the supposedly better build system (gradle) can't.

Up to now I still dont understand all this fuss I see about gradle, what is it exactly that gradle fetches online when I have all the necessary files required to build my project in my computer?.

This is really frustrating me as I don't guarantee myself to always have internet access

like image 786
AguThadeus Avatar asked Feb 08 '23 11:02

AguThadeus


1 Answers

First of all, Gradle has a local cache to store downloaded dependencies. If your new project requires some dependency, which was already used by some other project and stored in cache, then no need to download them again.

The second, why you may need to have an internet connection, is the ability to use on-line repositories, like Maven Central. You don't need to dowload all the jars manually and add them under your application's classpath and then manage it's transitive dependencies. All it's done by Gradle. Sure, Gradle let you provide local dependencies, if you need it, just rely on it as on files in your local filesystem. By the way, you may not specify exactly version of some dependency, but, for example, the latest one (that's called "dynamic version" and could be usefull during development). In that case, Gradle will check, whether the newer version is available and download it automatically.

And the last, if you still need it, you are free to make it running in offline mode.

like image 56
Stanislav Avatar answered Feb 11 '23 16:02

Stanislav