TL;DR: create a global gradle.properties file (in <HOME>/.gradle
or 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
gradle
settings 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:
C:\Users\<username>\.gradle
(Windows)${HOME}/.gradle/
(Mac/Linux)
It can also be custom set via
GRADLE_USER_HOME
-
Open (or create) gradle.properties in there.
-
Add the environment specific configuration (e.g. proxy)
-
Restart AS/gradle daemon...
-
Enjoy!
HTH,
Member discussion: