全局配置gradle参数,可以配置一些常用的编译版本等,就是有多个module中都使用了,可以使用,集中管理,project 下新建一个config.gradle即可,名字不是强制性的
导入的时候,导入制定路径即可
config.gradle 范例清单
ext { plugins = [ library : 'com.android.library', application: 'com.android.application', maven : 'com.github.dcendents.android-maven', bintray : 'com.jfrog.bintray' ] android = [ applicationId : "com.xxx.xxx", compileSdkVersion : 27, buildToolsVersion : "27.0.0", libMinSdkVersion : 8, minSdkVersion : 17, targetSdkVersion : 22, versionCode : 13, versionName : "1.0.13", ] bintray = [ version : "1.0.3", siteUrl : 'https://github.com/yanzhenjie/StatusView', gitUrl : 'git@github.com:yanzhenjie/StatusView.git', group : "com.yanzhenjie", // project packaging : 'aar', name : 'StatusView', description : 'StatusView for android', // project.license licenseName : 'The Apache Software License, Version 2.0', licenseUrl : 'http://www.apache.org/licenses/LICENSE-2.0.txt', // project.developers developerId : 'yanzhenjie', developerName : 'yanzhenjie', developerEmail: 'smallajax@foxmail.com', // bintray binrayLibrary : "StatusView", bintrayRepo : "maven", bintrayUser : 'yolanda', bintrayLicense: "Apache-2.0" ] dependencies = [ design : 'com.android.support:design:25.3.1', appCompat : 'com.android.support:appcompat-v7:25.3.1', recyclerView: 'com.yanzhenjie:recyclerview-swipe:1.1.1', statusView : 'com.yanzhenjie:statusview:1.0.3', support_appcompat_v7 : 'com.android.support:appcompat-v7:27.0.0', ] }
导入:
apply from : "config.gradle"
调用(例子):
compileSdkVersion rootProject.ext.android.compileSdkVersion