On which situation android-build/android-studio shows these errors?
Cannot access androidx.lifecycle.LifecycleOwner and
Cannot access androidx.lifecycle.ViewModelStoreOwner
What is the meaning of this errors? I found that adding androidx.lifecycle:lifecycle-viewmodel
as dependency solves these errors, I want to know the meaning of the error in terms of Android Activity LifeCycle(Or is it related to lifecycle or not).
For example in this code call to `super' onSavedInstanceState shows this error
public class AppActivity extends FragmentActivity {
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); // Cannot access androidx.lifecycle.LifecycleOwner
}
}
When should I use Android Lifecycles,and when should I avoid using it?
add this to your gradle dependencies
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
Update to the latest appcompat library version can help with this.
androidx.appcompat:appcompat:1.3.0-alpha01
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With