使用Hilt框架
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-kapt'
|
||||
id 'dagger.hilt.android.plugin'
|
||||
// id 'com.google.dagger.hilt.android'
|
||||
}
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
|
||||
//apply plugin: 'realm-android'
|
||||
android {
|
||||
namespace 'com.navinfo.volvo'
|
||||
@@ -21,7 +25,7 @@ android {
|
||||
// 指定room.schemaLocation生成的文件路径
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
|
||||
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
|
||||
}
|
||||
}
|
||||
ndk {
|
||||
@@ -41,45 +45,84 @@ android {
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
freeCompilerArgs += [
|
||||
"-Xjvm-default=all",
|
||||
]
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
dataBinding true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.8.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||
implementation 'com.google.android.material:material:1.7.0'
|
||||
implementation "androidx.compose.material3:material3:1.0.0-alpha04"
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
|
||||
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.1"
|
||||
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
|
||||
|
||||
|
||||
//room
|
||||
implementation 'com.tencent.wcdb:room:1.1-19' // 代替 room-runtime,同时也不需要再引用 wcdb-android
|
||||
|
||||
api 'androidx.sqlite:sqlite:2.2.0'
|
||||
implementation 'androidx.room:room-runtime:2.4.3'
|
||||
implementation 'androidx.room:room-ktx:2.4.3'
|
||||
annotationProcessor 'androidx.room:room-compiler:2.4.3'
|
||||
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
|
||||
kapt 'android.arch.persistence.room:compiler:1.1.1'// compiler 需要用 room 的
|
||||
kapt 'androidx.room:room-compiler:2.4.3'
|
||||
kapt 'androidx.room:room-ktx:2.4.3'
|
||||
androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
|
||||
// implementation "android.arch.lifecycle:extensions:1.1.1"
|
||||
// annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
|
||||
implementation 'com.tencent.wcdb:wcdb-android:1.1-19'
|
||||
|
||||
|
||||
// 文件选择器 https://github.com/rosuH/AndroidFilePicker/blob/master/README_CN.md
|
||||
implementation 'me.rosuh:AndroidFilePicker:0.8.2'
|
||||
// 时间选择器 https://github.com/Gredicer/datetimepicker
|
||||
implementation 'com.github.Gredicer:datetimepicker:V1.0.0'
|
||||
implementation 'com.google.code.gson:gson:2.10'
|
||||
implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
|
||||
// implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||
|
||||
// // Koin
|
||||
// implementation("io.insert-koin:koin-android:3.3.2")
|
||||
// implementation("io.insert-koin:koin-core:3.3.2")
|
||||
|
||||
// Retrofit 网络请求相关
|
||||
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
|
||||
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
|
||||
// const val chuck = "com.readystatesoftware.chuck:library:${Versions.chuck}"
|
||||
// const val chuckNoOp = "com.readystatesoftware.chuck:library-no-op:${Versions.chuck}"
|
||||
implementation("com.squareup.okhttp3:okhttp:4.9.0")
|
||||
implementation("com.squareup.okhttp3:logging-interceptor:4.9.0")
|
||||
implementation("com.google.code.gson:gson:2.8.6")
|
||||
|
||||
|
||||
//hilt
|
||||
implementation "com.google.dagger:hilt-android:2.41"
|
||||
kapt "com.google.dagger:hilt-compiler:2.41"
|
||||
// implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
|
||||
// androidTestImplementation "com.google.dagger:hilt-android-testing:2.41"
|
||||
// kaptAndroidTest "com.google.dagger:hilt-android-compiler:2.41"
|
||||
|
||||
}
|
||||
|
||||
kapt {
|
||||
correctErrorTypes true
|
||||
}
|
||||
Reference in New Issue
Block a user