小编X. *_*oid的帖子

为什么 Kotlin 的新 LiveData 构建器可能更新在我的项目中不起作用

在此处输入图片说明

这是我的依赖项:

 //Room and Lifecycle Libraries
    kapt "androidx.room:room-compiler:2.2.0-alpha02"
    kapt 'androidx.room:room-compiler:2.2.0-alpha02'
    kapt "androidx.lifecycle:lifecycle-compiler:2.2.0-alpha03"
    implementation "androidx.room:room-runtime:2.2.0-alpha02"
    implementation 'androidx.room:room-runtime:2.2.0-alpha02'
    implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0-alpha03"
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0-alpha03"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0-alpha03"
    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha03"
    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
Run Code Online (Sandbox Code Playgroud)

如您所见,我实现了最终版本,但我无法访问 liveData 构建器。我怎样才能解决这个问题?

android viewmodel android-lifecycle kotlin android-livedata

1
推荐指数
1
解决办法
367
查看次数