LiveData + ViewModel
def lifecycle_version = "2.2.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
Room
implementation "androidx.room:room-runtime:$room"
kapt "androidx.room:room-compiler:$room"
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$room"
Retrofit
// retrofit for networking
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
Moshi
// moshi for parsing the JSON format
def moshi_version = "1.8.0"
implementation "com.squareup.moshi:moshi:1.11.0"
implementation "com.squareup.moshi:moshi-kotlin:1.11.0"
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0"
moshi
需要在顶部添加kotlin-kapt
plugin.
kotlin 协程
// coroutines for getting off the UI thread
def coroutines = "1.3.9"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
// kotlin反射
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.4.21'
UI
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
图片
// glide for images
implementation 'com.github.bumptech.glide:glide:4.10.0'
kapt 'com.github.bumptech.glide:compiler:4.10.0'
其它
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'