最後更新日期:2022 年 10 月 31 日

build.gradle

buildscript {
    ext.nav_version = "2.5.3"
    ext.lifecycle_version = "2.5.1"
    ext.preference_version = "1.2.0"
    ext.room_version = "2.4.2"
    ext.work_version = "2.7.1"
    ext.coroutines_version = "1.6.3"

    ext.dexter_version = "6.2.2"
    ext.glide_version = "4.11.0"
    dependencies {
        // for fragment safe args
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
    }
}
...

app/build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'androidx.navigation.safeargs.kotlin'
    id 'kotlin-kapt'
}

android {
    ...
    packagingOptions {
        exclude 'META-INF/atomicfu.kotlin_module'
    }
    buildFeatures {
        viewBinding true
        dataBinding true
    }
}

dependencies {
    ...
    
    // fragment navigation component
    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

    // preference
    implementation "androidx.preference:preference:$preference_version"

    // Lifecycle components
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    
    // Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
		
    // WorkManager 
    implementation "androidx.work:work-runtime-ktx:$work_version"

    // RecyclerView
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation "androidx.cardview:cardview:1.0.0"

    // Room
    implementation "androidx.room:room-runtime:$room_version"
    implementation "androidx.room:room-ktx:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    // dexter
    implementation "com.karumi:dexter:$dexter_version"
    
    // glide
    implementation "com.github.bumptech.glide:glide:$glide_version"
    annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"

    // OkHttp3
    implementation "com.squareup.okhttp3:okhttp:4.10.0"
    implementation "com.squareup.okhttp3:logging-interceptor:4.10.0"
		
    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:2.9.0"
    implementation "com.squareup.retrofit2:converter-gson:2.9.0"
    implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"

    // RxJava
    implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
    implementation "io.reactivex.rxjava3:rxjava:3.0.0"

		
    ...
}

Reference

最新的 androidx 函式庫版本

Last modified: 2022 年 10 月 31 日

Author

Comments

Write a Reply or Comment

Your email address will not be published.