Android中Room数据的使用

build.gradle中添加

id 'kotlin-kapt'

  如图

 

 或者添加

apply plugin: 'kotlin-kapt'

dependencies中添加

implementation("androidx.room:room-runtime:2.3.0")
    annotationProcessor("androidx.room:room-compiler:2.3.0")

    // To use Kotlin annotation processing tool (kapt)
    kapt("androidx.room:room-compiler:2.3.0")
    // To use Kotlin Symbolic Processing (KSP)
    //ksp("androidx.room:room-compiler:2.3.0")

    // optional - Kotlin Extensions and Coroutines support for Room
    //implementation("androidx.room:room-ktx:$roomVersion")

    // optional - RxJava2 support for Room
    //implementation("androidx.room:room-rxjava2:$roomVersion")

    // optional - RxJava3 support for Room
    //implementation("androidx.room:room-rxjava3:$roomVersion")

    // optional - Guava support for Room, including Optional and ListenableFuture
    //implementation("androidx.room:room-guava:$roomVersion")

    // optional - Test helpers
    //testImplementation("androidx.room:room-testing:$roomVersion")

    // optional - Paging 3 Integration
    //implementation("androidx.room:room-paging:2.4.0-beta02")

  

posted on 2021-12-06 11:04  巫山老妖  阅读(499)  评论(0编辑  收藏  举报