前言
用AS开发项目,依赖了多个Module,我们需要保持 module和app的版本是一致的,所以我们借鉴Google 开源项目的做法
在Project build 里面加入
ext {
// Sdk and tools
minSdkVersion = 10
targetSdkVersion = 24
compileSdkVersion = 24
buildToolsVersion = '24.0.2'
// App dependencies
supportLibraryVersion = '24.2.0'
guavaVersion = '18.0'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
powerMockito = '1.6.2'
hamcrestVersion = '1.3'
runnerVersion = '0.5'
rulesVersion = '0.5'
espressoVersion = '2.2.2'
daggerVersion = '2.7'
dexmakerVersion = '1.2'
}
然后在App build 文件里加入,按照下面的模板就可以了。
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
compile "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espressoVersion"
compile "com.google.guava:guava:$rootProject.guavaVersion"
// Dagger dependencies
apt "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"
provided 'org.glassfish:javax.annotation:10.0-b28'
compile "com.google.dagger:dagger:$rootProject.daggerVersion"
网友评论