java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleObserver"


#1

I started getting this error recently and I am not sure why when using the mapbox plugin on android:

java.lang.ClassNotFoundException: Didn’t find class “android.arch.lifecycle.LifecycleObserver”

More info here:

Any ideas what could be causing this?

Thank You.


#2

Have you tried adding a dependency to the andrid.arch.lifecycle Android library?

https://developer.android.com/topic/libraries/architecture/release-notes.html#january_22_2018


#3

I didn’t but I will try that tonight. Thank you for the suggestion.


#4

I adde the following to app.gradle and it worked.

compile ('android.arch.lifecycle:livedata:1.1.0') {
        force = true;
    }
    compile ('android.arch.lifecycle:viewmodel:1.1.0') {
        force = true;
    }

Thank you very much.