美文网首页
Android 统一管理依赖配置

Android 统一管理依赖配置

作者: 岁月无痕灬灬 | 来源:发表于2018-08-25 16:41 被阅读19次

1.新建配置xx.gradle文件

例如:xxx.gradle内容如下

ext {
    Android = [
            compileSdkVersion: 27,
            applicationId    : "com.xxx.xxx",
            minSdkVersion    : 17,
            targetSdkVersion : 27,
            versionCode      : 1,
            versionName      : "1.0"
    ]

    SupportVersion = "27.1.1"

    Dependencies = [
            SupportV7                     : "com.android.support:appcompat-v7:${SupportVersion}",
            SupportV4                     : "com.android.support:support-v4:${SupportVersion}",
            Design                        : "com.android.support:design:${SupportVersion}"
    ]
}

2.在项目根目录build.gradle中加入

apply from: "xxx.gradle"

3.在app目录下配置

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation Dependencies.SupportV7
    implementation Dependencies.ConstraintLayout
    implementation Dependencies.SupportV4
    implementation Dependencies.Design
}

相关文章

网友评论

      本文标题:Android 统一管理依赖配置

      本文链接:https://www.haomeiwen.com/subject/pgegiftx.html