Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle.properties vs buildscript ext which one is better

gradle.properties code snippet

APP_BUILD_COMPILE_SDK_VERSION=28
APP_BUILD_TOOLS_VERSION = 27.0.3

APP_BUILD_MIN_SDK_VERSION = 16
APP_BUILD_TARGET_SDK_VERSION = 28

supportLibraryVersion = '23.4.0'
playServicesVersion = '9.2.1'

buildscript ext code snippet

ext {
    // sdk and tools
    minSdkVersion = 14
    targetSdkVersion = 23
    compileSdkVersion = 23
    buildToolsVersion = '23.0.2'

    // dependencies versions
    supportLibraryVersion = '23.4.0'
    playServicesVersion = '9.2.1'
}

I've used both in my different projects but anyone knows what is the best difference of them?

like image 737
Nicky Avatar asked Mar 13 '19 06:03

Nicky


1 Answers

Extra properties is a special extension of type ExtraPropertiesExtension added with name ext.

Properties passed with -P command line options or added to gradle.properties file are added to the extra properties extension. They’re simply added to one of existing scope

like image 199
Gabriele Mariotti Avatar answered Nov 30 '22 08:11

Gabriele Mariotti