Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some light on gradle.properties, settings.gradle, gradle-wrapper.properties and local.properties

I use them often when configuring my project but mostly add snippers as instructed. I have absolutely no clue which file is for what exactly. Can anyone give a clear picture what each file is for.

So far I think

local.properties for environment paths like sdk/ndk location

settings.gradle for including all modules in project where each module has it's own build.gradle

gradle.properties ?
gradle-wrapper.properties ?

like image 307
ir2pid Avatar asked Oct 28 '25 13:10

ir2pid


1 Answers

gradle.properties

Using gradle.properties to create universal variables This solution is limited to Android projects as far as I know. In /gradle.properties you can define your universal or project level variables as such: Link

myBuildToolsVersion=20.0.0

myMinSdkVersion=10

myTargetSdkVersion=22

myCompileSdkVersion=22

gradle-wrapper.properties

Internally, Android Studio uses the version of Gradle that is defined in the wrapper configuration. That configuration can be found in gradle/wrapper/gradle-wrapper.properties. When Google decides that it is time to use a new version of Gradle, Android Studio will display a message nudging you to upgrade. All you need to do then is click the message and Android Studio will edit the properties file and synchronize the Gradle installation for you. Link

local.properties

The local.properties file goes in the project's root level.

This file should not be included in source control. After (incorrectly) including this in source control, then deleting the file locally, Android Studio re-created the file for me automatically.

Here is the example content of this file:

## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu Aug 14 14:49:26 PDT 2014
sdk.dir=C\:\\Program Files (x86)\\Android\\android-studio\\sdk

Note the sdk.dir= reference to the location of the Android Studio SDK installation (which may be different on different machines). Link

settings.gradle

  • ':lib' is a logical project path, which gets mapped to a physical path based on information provided in settings.gradle.
  • A multi-project build can have an arbitrary directory structure, which is configured in settings.gradle. No need to move directories around, unless you want to. Link

For more and more info about gradle you need to check below links which help you more know about gradle and gradle system. Gradle makes developer life easy for not taking to much headache about library updation , apk generation , import lib easily , product flavors and many more.

http://www.vogella.com/tutorials/Gradle/article.html https://developer.android.com/studio/build/gradle-tips.html

like image 139
duggu Avatar answered Oct 31 '25 04:10

duggu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!