gradle.properties vs buildscript ext 哪一个更好



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'

构建脚本扩展代码片段

ext {
// sdk and tools
minSdkVersion = 14
targetSdkVersion = 23
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
// dependencies versions
supportLibraryVersion = '23.4.0'
playServicesVersion = '9.2.1'
}

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

额外属性是ExtraPropertiesExtension类型的特殊扩展,以名称ext添加。

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

相关内容

最新更新