Timor Gruber Timor Gruber - 5 months ago 18
Android Question

Configuring gradle completely offline

So I have a PC at work which can't be connected to the internet by any means, and it should be a developing PC for android apps, preferably using gradle.
I'm using IntelliJ IDEA as my IDE (Same as Android Studio) and I know gradle has an option for offline work.

However, ticking the offline box didn't help as the gradle was not distributed locally - And so I've managed to install a local distribution of the latest gradle version.

But even this isn't enough as it fails to sync AGAIN, only this time it says it it can't a cached version which is available for offline mode.

After reading a bit on the subject, I've found out that the most common solution to this problem is to let Gradle connect to the internet the first time a project builds, so it will get its' required dependencies and stuff, and then you can switch it back to offline.

Problem is: I can't have any connection to the internet, not even for a brief moment or some proxy servers or whatsoever.

Can I somehow manage to distribute Gradle completely offline?


The only option you have is to check out the project on another machine that does have internet access, resolve all dependencies so you have them in the cache (~/.gradle/caches) and then copy the cache directory to the machine that does not have internet access. From thereon Gradle has all dependencies required for your project. Don't forget to run Gradle with --offline.

Alternatively, you could copy of all required JAR files to a specific directory which you reference as flat directory repository.