When I try to upgrade androidx.lifecycle:lifecycle-viewmodel
from 2.7.0
to 2.8.1
– error pops out:
Cannot resolve symbol ‘AndroidViewModelFactory’
The code snippet is:
new ViewModelProvider(this, AndroidViewModelFactory.getInstance(getApplication()))
.get(CameraXViewModel.class)
.getProcessCameraProvider()
.observe(
this,
provider -> {
cameraProvider = provider;
bindAllCameraUseCases();
});
Question: Is there a way to get the same behaviour but without AndroidViewModelFactory
?