studio 版本统一管理记录

 1.studio 版本统一管理,现在project中的build.gradle添加ext{}。



buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
       
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

/** 统一管理版本号 **/
ext{
    // 用于编译的SDK 版本
    compileSdkVersion_all = 28
    //  最低支持Android版本
    minSdkVersion_all = 21
    //  目标版本
    targetSdkVersion_all = 28
    //  用于Gradle编译项目的工具版本
    buildToolsVersion_all = '24.0.2'
    // 版本编号
    versionCode_all = 1
    // 版本号
    versionName_all = '1.0.0'
    /** Android 依赖 jar 包**/
    supportV7_all = 'com.android.support:appcompat-v7:28.0.0'
    constraint_layout_all = 'com.android.support.constraint:constraint-layout:1.1.3'
    junit_all = 'junit:junit:4.12'
    support_runne_all = 'com.android.support.test:runner:1.0.2'
    support_espresso_all = 'com.android.support.test.espresso:espresso-core:3.0.2'
    /** 第三方框架   **/
}

2.在APP中的build.gradle中引用。

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion_all
    defaultConfig {
        applicationId "com.gdvictor.technologyproject"
        minSdkVersion rootProject.ext.minSdkVersion_all
        targetSdkVersion rootProject.ext.targetSdkVersion_all
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation rootProject.ext.supportV7_all
    implementation rootProject.ext.constraint_layout_all
    testImplementation rootProject.ext.junit_all
    androidTestImplementation rootProject.ext.support_runne_all
    androidTestImplementation rootProject.ext.support_espresso_all
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值