android studio gradle统一管理版本

休言女子非英物,夜夜龙泉壁上鸣。这篇文章主要讲述android studio gradle统一管理版本相关的知识,希望能为你提供帮助。
创建config.gradle

ext { android = [ compileSdkVersion: 26, buildToolsVersion: "26.0.2", minSdkVersion: 15, targetSdkVersion: 26, versionCode: 1, versionName: "1.0", androidSupportVersion: "26.1.0", ] dependencies = [ "annotations": "com.android.support:support-annotations:${android["androidSupportVersion"]}", "appcompat-v7": "com.android.support:appcompat-v7:${android["androidSupportVersion"]}", "design": "com.android.support:design:${android["androidSupportVersion"]}", ] }

使用
project--gradle
apply from : "config.gradle"

app--gradle
defaultConfig { applicationId "com.example.ma.demo" minSdkVersion rootProject.ext.android["minSdkVersion"] targetSdkVersion rootProject.ext.android["targetSdkVersion"] versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }

dependencies { implementation fileTree(include: [‘*.jar‘], dir: ‘libs‘) implementation rootProject.ext.dependencies["appcompat-v7"]
}

【android studio gradle统一管理版本】 


    推荐阅读