Set Different Gradle Configurations
TL;DR: create a global gradle.properties file (in
GRADLE_USER_HOME if defined). Place there the system specific configuration.
The other day I had the unpleasant surprise that Android Studio replicated my proxy settings into gradle.properties and got committed to Git. Including a password (which has since became obsolete). Since my other environment doesn’t use a proxy, I got an error there. Now, the question became:
How do I create a single project
gradlesettings file which would allow me to run smoothly in both places?
Although I thought of a command line things, the answer is much simpler: Use the global
gradle configuration file. The steps are:
- Identify your gradle local path. It’s usually in:
It can also be custom set via
Open (or create) gradle.properties in there.
- Add the environment specific configuration (e.g. proxy)
- Restart AS/gradle daemon…
A little experiment: If you find this post and ad below useful, please check the ad out 🙂