定义变量:
gradle.properties
COMPILE_SDK_VERSION=25BUILD_TOOLS_VERSION=25.0.0TARGET_SDK_VERSION=23MIN_SDK_VERSION=8
使用变量:
build.gradle中
apply plugin: 'com.android.application'android {compileSdkVersion COMPILE_SDK_VERSION as int buildToolsVersion BUILD_TOOLS_VERSIONdefaultConfig {minSdkVersion MIN_SDK_VERSION as int targetSdkVersion TARGET_SDK_VERSION as int }