gradle.properties 与 buildscript ext 哪个更好

Nic*_*cky 5 android build.gradle android-gradle-plugin

gradle.properties 代码片段

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'
Run Code Online (Sandbox Code Playgroud)

buildscript ext 代码片段

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

    // dependencies versions
    supportLibraryVersion = '23.4.0'
    playServicesVersion = '9.2.1'
}
Run Code Online (Sandbox Code Playgroud)

我在不同的项目中都使用过,但有人知道它们的最大区别是什么吗?

Gab*_*tti 3

额外属性是类型的特殊扩展ExtraPropertiesExtension额外属性是用 name 添加的ext

\n\n

使用-P命令行选项传递或添加到gradle.properties文件的属性将添加到额外属性扩展中。它们\xe2\x80\x99re只是添加到现有范围之一

\n