gpt4 book ai didi

android - 为什么来自 Kotlin May 更新的新 LiveData 构建器在我的项目中不起作用

转载 作者:行者123 更新时间:2023-11-29 16:29:23 26 4
gpt4 key购买 nike

enter image description here

这是我的依赖项:

 //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'

如您所见,我实现了最终版本,但我无权访问 liveData 构建器。我该如何解决这个问题?

最佳答案

来自documentation :

For liveData, use androidx.lifecycle:lifecycle-livedata-ktx:2.2.0-alpha01 or higher.

所以你只是缺少依赖:

implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0-alpha03"

关于android - 为什么来自 Kotlin May 更新的新 LiveData 构建器在我的项目中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57592885/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com