I have a command line apk generator which compiles a lot of APKs using the same source code, so these apps have the same dependences.
In gradle documentation i can see this:
The Gradle project needs network connectivity to download dependencies.
Gradle does a good job of avoiding redownloading artifacts, but you can pass
--offline to grade to prevent from accessing the network during builds. If it needs something from the network that it doesn't have, instead of attempting to fetch it, your build will fail.