????????汾:
????def cfg = rootProject.ext.configuration
????cfg.compileVersion
??????汾:
????def libs = rootProject.ext.libraries
????${libs.retrofit}
????2. ????????
????buildConfigField??????в????? ??????gradle.properties????.
????android {
????defaultConfig {
????buildConfigField "String"?? "MARVEL_PUBLIC_KEY"?? ""${marvel_public_key}""
????buildConfigField "String"?? "MARVEL_PRIVATE_KEY"?? ""${marvel_private_key}""
????}
????}
???????ò??????????????λ??????????.
????marvel_public_key   = 74129ef99c9fd5f7692608f17abb88f9
????marvel_private_key  = 281eb4f077e191f7863a11620fa1865f2940ebeb
????δ???·???? ???????????gradle.properties??.
??????????????????ò????? ??????????build.gradle?? ?????gradle.properties.
????????????BuildConfig.xxx???????.
????MarvelSigningIterceptor signingIterceptor = new MarvelSigningIterceptor(
????BuildConfig.MARVEL_PUBLIC_KEY?? BuildConfig.MARVEL_PRIVATE_KEY);
????3. ?汾????
?????汾???????????????build.gradle?У? ????????????? ??????????汾?? ???????汾. ????ò??????ó??????. ????????rootProject.ext.xxx?????????.
ext {
configuration = [
package          : "me.chunyu.spike.springrainnews"??
buildToolsVersion: "23.0.1"??
compileVersion   : 23??
minSdk           : 14??
targetSdk        : 23??
version_code     : 1??
version_name     : "0.0.1"??
]
libraries = [
supportVersion    : "23.1.1"??
retrofit          : "2.0.0-beta2"??
rxandroid         : "1.1.0"??
dagger            : "2.0"??
javax_annotation  : "10.0-b28"??
butterknife       : "7.0.1"??
glide             : "3.6.1"??
recycler_animators: "2.1.0"??
circleimageview   : "2.0.0"
]
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha5'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.4'
classpath 'com.android.databinding:dataBinder:1.0-rc4'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
????????
????Retrolambda???????÷??
plugins {
id "me.tatarka.retrolambda" version "3.2.5"
}
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
???????????????????Android????? ??????????汾??? ?????????.