1.使用Android Studio 切换到Project目录,在config.gradle配置
def releaseTime() {
return (new Date().format("yyyyMMddHH", TimeZone.getTimeZone("GMT+08:00"))) //格林时间+8小时=中国时区
}
ext {
//android开发版本配置
android = [
compileSdkVersion: 29,
applicationId : "com.etrans.ywb",
minSdkVersion : 21,
targetSdkVersion : 29,
versionCode : 1,
versionName : "1.0.${releaseTime()}",
]
//version配置
versions = [
"androidx-version": "1.0.0",
"junit-version" : "4.12",
]
//support配置
support = [
'support-v4' : "androidx.legacy:legacy-support-v4:${ versions["androidx-version"]}",
'appcompat-v7' : "androidx.appcompat:appcompat:${versions["androidx-version"]}",
'cardview-v7' : "androidx.cardview:cardview:${versions["androidx-version"]}",
// 'support-v13' : "androidx.legacy:legacy-support-v13:${versions["androidx-version"]}",
// 'recyclerview-v7' : "androidx.recyclerview:recyclerview:${versions["androidx-version"]}",
// 'support-fragment' : "androidx.fragment:fragment:${versions["androidx-version"]}",
// 'animated-vector-drawable': "androidx.vectordrawable:vectordrawable-animated:${versions["androidx-version"]}",
// "constraint-layout" : "androidx.constraintlayout:constraintlayout:1.1.2",
'design' : 'com.google.android.material:material:1.0.0',
// 'junit' : "junit:junit:${versions["junit-version"]}",
]
//依赖第三方配置
dependencies = [
//rxjava
"rxjava" : "io.reactivex.rxjava2:rxjava:2.1.12",
"rxandroid" : "io.reactivex.rxjava2:rxandroid:2.0.2",
//rx管理View的生命周期
"rxlifecycle" : "com.trello.rxlifecycle2:rxlifecycle:2.2.1",
"rxlifecycle-components" : "com.trello.rxlifecycle2:rxlifecycle-components:2.2.1",
//rxbinding
"rxbinding" : "com.jakewharton.rxbinding2:rxbinding:2.1.1",
//rx 6.0权限请求
"rxpermissions" : "com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar",
//network
"okhttp" : "com.squareup.okhttp3:okhttp:3.10.0",
"retrofit" : "com.squareup.retrofit2:retrofit:2.4.0",//2.7访问请求报未知错误,2.8安卓7.0报错
"converter-gson" : "com.squareup.retrofit2:converter-gson:2.4.0",
"adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava2:2.4.0",//
//glide图片加载
"glide" : "com.github.bumptech.glide:glide:4.11.0",
"glide-compiler" : "com.github.bumptech.glide:compiler:4.11.0",
//json解析
"gson" : "com.google.code.gson:gson:2.8.2",
//material-dialogs
"material-dialogs-core" : "com.afollestad.material-dialogs:core:0.9.4.5",
"material-dialogs-commons" : "com.afollestad.material-dialogs:commons:0.9.4.5",
//recyclerview的databinding套装 github: https://github.com/evant/binding-collection-adapter
"bindingcollectionadapter" : "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:2.2.0",
"bindingcollectionadapter-recyclerview": "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:2.2.0",
//Google新组件
// "lifecycle-extensions" : "android.arch.lifecycle:extensions:1.0.0",
]
}