1.在根目录下的build.gradle文件下添加 ext{ .... } 中的内容
......
// Define versions in a single place
ext {
// SDK And Tools
compileSdkVersion = 25
buildToolsVersion = "25.0.0"
minSdkVersion = 16
targetSdkVersion = 25
versionCode = 1
versionName = "1.0"
}
......
2.在app目录下build.gradle中使用 $rootProject.supportLibraryVersion
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId 'com.mainiway.demo'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0.0"
}
}
dependencies {
......
}