Modify: 引入依赖库并统一配置管理
This commit is contained in:
@ -3,6 +3,7 @@ import com.quyunshuo.androidbaseframemvvm.build.*
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
compileSdkVersion BuildConfig.compileSdkVersion
|
||||
@ -14,8 +15,13 @@ android {
|
||||
targetSdkVersion BuildConfig.targetSdkVersion
|
||||
versionCode BuildConfig.versionCode
|
||||
versionName BuildConfig.versionName
|
||||
testInstrumentationRunner AndroidX.AndroidJUnitRunner
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@ -24,16 +30,45 @@ android {
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
viewBinding {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.3.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
testImplementation Android.Junit
|
||||
implementation AndroidX.CoreKtx
|
||||
implementation AndroidX.AppCompat
|
||||
implementation AndroidX.ConstraintLayout
|
||||
implementation AndroidX.ActivityKtx
|
||||
implementation AndroidX.FragmentKtx
|
||||
androidTestImplementation AndroidX.TestExtJunit
|
||||
androidTestImplementation AndroidX.TestEspresso
|
||||
|
||||
implementation Kotlin.Kotlin
|
||||
implementation Kotlin.CoroutinesCore
|
||||
implementation Kotlin.CoroutinesAndroid
|
||||
|
||||
implementation JetPack.LifecycleRuntimeKtx
|
||||
implementation JetPack.LifecycleViewModel
|
||||
implementation JetPack.LifecycleViewModelKtx
|
||||
implementation JetPack.HiltLifecycleViewModel
|
||||
implementation JetPack.HiltDaggerAndroid
|
||||
kapt JetPack.HiltDaggerCompiler
|
||||
kapt JetPack.Hilt
|
||||
|
||||
implementation GitHub.OkHttp
|
||||
implementation GitHub.OkHttpInterceptorLogging
|
||||
implementation GitHub.Retrofit
|
||||
implementation GitHub.RetrofitConverterGson
|
||||
implementation GitHub.Gson
|
||||
implementation GitHub.MMKV
|
||||
implementation GitHub.AutoSize
|
||||
implementation GitHub.Glide
|
||||
kapt GitHub.GlideCompiler
|
||||
implementation GitHub.ARoute
|
||||
kapt GitHub.ARouteCompiler
|
||||
implementation GitHub.RecyclerViewAdapter
|
||||
}
|
||||
13
build.gradle
13
build.gradle
@ -1,16 +1,15 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
import com.quyunshuo.androidbaseframemvvm.build.*
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = "1.4.0"
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:4.0.1"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
classpath ProjectPluginManager.AndroidToolsPlugin
|
||||
classpath ProjectPluginManager.KotlinPlugin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
package com.quyunshuo.androidbaseframemvvm.build
|
||||
|
||||
/**
|
||||
* 依赖库管理
|
||||
*/
|
||||
object Version {
|
||||
// AndroidX--------------------------------------------------------------
|
||||
const val AppCompat = "1.2.0"
|
||||
const val CoreKtx = "1.3.1"
|
||||
const val ConstraintLayout = "2.0.1" // 约束布局
|
||||
const val TestExtJunit = "1.1.2"
|
||||
const val TestEspresso = "3.3.0"
|
||||
const val ActivityKtx = "1.1.0"
|
||||
const val FragmentKtx = "1.2.5"
|
||||
// Android---------------------------------------------------------------
|
||||
const val Junit = "4.13"
|
||||
// Kotlin----------------------------------------------------------------
|
||||
const val Kotlin = "1.4.0"
|
||||
const val Coroutines = "1.3.7" // 协程
|
||||
// JetPack---------------------------------------------------------------
|
||||
const val LifecycleViewModel = "2.2.0"
|
||||
const val LifecycleRuntimeKtx = "2.2.0"
|
||||
const val LifecycleViewModelKtx = "2.2.0"
|
||||
const val Hilt = "1.0.0-alpha02" // Hilt 依赖注入
|
||||
const val HiltLifecycleViewModel = "1.0.0-alpha02"
|
||||
const val HiltDagger = "2.28-alpha"
|
||||
// GitHub----------------------------------------------------------------
|
||||
const val OkHttp = "3.14.9" // OkHttp
|
||||
const val OkHttpInterceptorLogging = "3.12.0" // OkHttp 请求Log拦截器
|
||||
const val Retrofit = "2.9.0" // Retrofit
|
||||
const val RetrofitConverterGson = "2.9.0" // Retrofit Gson 转换器
|
||||
const val Gson = "2.8.6" // Gson
|
||||
const val MMKV = "1.2.2" // 腾讯 MMKV 替代SP
|
||||
const val AutoSize = "1.2.1" // 屏幕适配
|
||||
const val Glide = "4.11.0" // Glide
|
||||
const val ARoute = "1.5.0" // 阿里路由
|
||||
const val ARouteCompiler = "1.2.2" // 阿里路由 APT
|
||||
const val RecyclerViewAdapter = "3.0.4" // RecyclerViewAdapter
|
||||
}
|
||||
|
||||
object AndroidX {
|
||||
const val AndroidJUnitRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
const val AppCompat = "androidx.appcompat:appcompat:${Version.AppCompat}"
|
||||
const val CoreKtx = "androidx.core:core-ktx:${Version.CoreKtx}"
|
||||
const val ConstraintLayout =
|
||||
"androidx.constraintlayout:constraintlayout:${Version.ConstraintLayout}"
|
||||
const val TestExtJunit = "androidx.test.ext:junit:${Version.TestExtJunit}"
|
||||
const val TestEspresso = "androidx.test.espresso:espresso-core:${Version.TestEspresso}"
|
||||
const val ActivityKtx = "androidx.activity:activity-ktx:${Version.ActivityKtx}"
|
||||
const val FragmentKtx = "androidx.fragment:fragment-ktx:${Version.FragmentKtx}"
|
||||
}
|
||||
|
||||
object Android {
|
||||
const val Junit = "junit:junit:${Version.Junit}"
|
||||
}
|
||||
|
||||
object JetPack {
|
||||
const val LifecycleViewModel =
|
||||
"androidx.lifecycle:lifecycle-viewmodel:${Version.LifecycleViewModel}"
|
||||
const val LifecycleRuntimeKtx =
|
||||
"androidx.lifecycle:lifecycle-runtime-ktx:${Version.LifecycleRuntimeKtx}"
|
||||
const val LifecycleViewModelKtx =
|
||||
"androidx.lifecycle:lifecycle-viewmodel-ktx:${Version.LifecycleViewModelKtx}"
|
||||
const val Hilt = "androidx.hilt:hilt-compiler:${Version.Hilt}"
|
||||
const val HiltLifecycleViewModel =
|
||||
"androidx.hilt:hilt-lifecycle-viewmodel:${Version.HiltLifecycleViewModel}"
|
||||
const val HiltDaggerAndroid = "com.google.dagger:hilt-android:${Version.HiltDagger}"
|
||||
const val HiltDaggerCompiler =
|
||||
"com.google.dagger:hilt-android-compiler:${Version.HiltDagger}"
|
||||
}
|
||||
|
||||
object Kotlin {
|
||||
const val Kotlin = "org.jetbrains.kotlin:kotlin-stdlib:${Version.Kotlin}"
|
||||
const val CoroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Version.Coroutines}"
|
||||
const val CoroutinesAndroid =
|
||||
"org.jetbrains.kotlinx:kotlinx-coroutines-android:${Version.Coroutines}"
|
||||
}
|
||||
|
||||
object GitHub {
|
||||
const val OkHttp = "com.squareup.okhttp3:okhttp:${Version.OkHttp}"
|
||||
const val OkHttpInterceptorLogging =
|
||||
"com.squareup.okhttp3:logging-interceptor:${Version.OkHttpInterceptorLogging}"
|
||||
const val Retrofit = "com.squareup.retrofit2:retrofit:${Version.Retrofit}"
|
||||
const val RetrofitConverterGson =
|
||||
"com.squareup.retrofit2:converter-gson:${Version.RetrofitConverterGson}"
|
||||
const val Gson = "com.google.code.gson:gson:${Version.Gson}"
|
||||
const val MMKV = "com.tencent:mmkv-static:${Version.MMKV}"
|
||||
const val AutoSize = "me.jessyan:autosize:${Version.AutoSize}"
|
||||
const val Glide = "com.github.bumptech.glide:glide:${Version.Glide}"
|
||||
const val GlideCompiler = "com.github.bumptech.glide:compiler:${Version.Glide}"
|
||||
const val ARoute = "com.alibaba:arouter-api:${Version.ARoute}"
|
||||
const val ARouteCompiler = "com.alibaba:arouter-compiler:${Version.ARouteCompiler}"
|
||||
const val RecyclerViewAdapter =
|
||||
"com.github.CymChad:BaseRecyclerViewAdapterHelper:${Version.RecyclerViewAdapter}"
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.quyunshuo.androidbaseframemvvm.build
|
||||
|
||||
/**
|
||||
* 项目级插件管理
|
||||
*/
|
||||
object ProjectPluginManager {
|
||||
const val AndroidToolsPlugin = "com.android.tools.build:gradle:4.0.1"
|
||||
const val KotlinPlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
|
||||
}
|
||||
Reference in New Issue
Block a user