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 {  
  ......
}  

相关文章:

  • 2022-12-23
  • 2021-10-27
  • 2021-06-04
  • 2021-12-11
  • 2022-12-23
  • 2021-05-16
  • 2021-06-22
猜你喜欢
  • 2021-12-01
  • 2021-12-12
  • 2021-09-10
  • 2021-08-29
  • 2021-03-29
  • 2021-09-25
相关资源
相似解决方案