Jonny
Jonny

Reputation: 306

How to handle android gradle.properties file for different environments

im working with a version control system. in my windows client environment i've created a property in 'gradle.properties' i.e : myPath=c:/Program Files/aaa/bbbb

i've also a mac client environment, how can i customize 'gradle.properties' to work with mac too. i.e : myPath=/mac/aaa/bbbb

i dont want to edit the file manualy on mac each time

Upvotes: 1

Views: 1033

Answers (1)

nexus5x
nexus5x

Reputation: 467

You can have a gradle.properties file in your home directory;

  • on Windows: C:\Users\<username>\.gradle\gradle.properties
  • on Mac: /Users/<username>/.gradle/gradle.properties

Create a new gradle.properties file in your home directory on each system, Windows and OSX, and add myPath property to those files. Then remove that property(myPath) from your project directory gradle.properties, so that the property is no longer managed by your version control system.

Note that the gradle.properties file in home directory will be applied to all other gradle projects. I recommend you use a project specific property name, e.g. MY_PROJECT_A_PATH=/mac

Sources: https://docs.gradle.org/current/userguide/build_environment.html https://docs.gradle.org/current/userguide/gradle_daemon.html

Upvotes: 4

Related Questions