gradle.properties vs buildscript ext 哪个更好
gradle.properties vs buildscript ext which one is better
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'
buildscript 分机代码片段
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
文件的属性 添加到额外的属性扩展 。它们只是添加到现有范围之一
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'
buildscript 分机代码片段
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
文件的属性 添加到额外的属性扩展 。它们只是添加到现有范围之一