gradleandroid-gradle-plugingradle.properties

Which file gradle.properties is higher priority?


I have local and global gradle.properties, the global one is needed to configure the proxy, but it also contains other parameters, wondering what happens if for the same settings you specify different values, which of the files will be in priority or maybe they are How do they merge?

my global gradle.properties

systemProp.http.proxyHost=hostname
systemProp.http.proxyPort=8080
systemProp.http.proxyPassword=password

org.gradle.parallel=false

my local gradle.properties

android.useDeprecatedNdk=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4096M

For example, which org.gradle.parallel will be used?


Solution

  • According to the Gradle properties, the gradle.properties files are applied in the following order:

    1. gradle.properties in project root directory.
    2. gradle.properties in GRADLE_USER_HOME directory.
    3. system properties, e.g. when -Dgradle.user.home is set on the command line.

    Because the properties in GRADLE_USER_HOME are applied after the ones in the project root, they override the ones defined in the project. Assuming that with global you mean the one in the GRADLE_USER_HOME directory and local the one in your project root, your value for org.gradle.parallel will be false.