我已经添加了依赖项,但仍然出现错误。
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01'
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha01'
未解决的引用:viewModels。
我已经添加了依赖项,但仍然出现错误。
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01'
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha01'
fragment-ktx
和activity-ktx
。implementation "androidx.fragment:fragment-ktx:1.2.5"
implementation "androidx.activity:activity-ktx:1.1.0"
这也取决于你想如何使用依赖关系。
//to add the dependency on Fragment
implementation 'androidx.fragment:fragment-ktx:1.2.5'
//to add the dependency on the Activity
implementation 'androidx.activity:activity-ktx:1.1.0'