Unresolved reference: SavedStateVMFactory

129
July 07, 2019, at 03:20 AM

I am following the "Guide to app architecture" (Jetpack) and it cannot resolve references as below.

I already added the libraries:

build.gradle (Module: app):

def lifecycle_version = "2.0.0"
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"

build.gradle (Project: ProjectName)

allprojects {
    repositories {
        google()
        jcenter()    
    }
}

What is missing to work?

Answer 1

There's two issues:

1) ViewModel-SavedState is a separate artifact that needs to be included:

def viewmodel_savedstate_version = "1.0.0-alpha02"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha01"

2) As per the 1.0.0-alpha02 release notes:

SavedStateVMFactory is renamed to SavedStateViewModelFactory.

So make sure you're using SavedStateViewModelFactory in any place where you would otherwise have used SavedStateVMFactory.

Rent Charter Buses Company
READ ALSO
Using Recyclerview like gridview

Using Recyclerview like gridview

I am trying to use recyclerview like gridviewBut i have a problem

129
Difference between global actions and destination specific action in android navigation graphs?

Difference between global actions and destination specific action in android navigation graphs?

In android navigation graphs, we have global actions and action within a destination

120
Black Screen On kivy

Black Screen On kivy

I have made a code of my App in kivy, where On main Screen, I have two buttons, both when pressed go to other page but call record and screengrab function respectivelyI think there is a problem in routing of providing the function to button

169
How can I find this layout file app/src/main/res/layout/activity_main.xml

How can I find this layout file app/src/main/res/layout/activity_main.xml

I study a course and it told me to edit this layout file, How can I find it please because I searched on it and I did not find it

119