NoClassDefFoundError Landroid/arch/lifecycle/LifecycleDispatcher

I was using some gradle configurations

android.enableR8.desugaring=false
android.enableJetifier=true
android.useAndroidX=true

To work again I removed android.enableR8.desugaring=false of gradle.properties file


Add the dependencies in the build.gradle of the app in my scenario was using a library that needed those dependencies

For android X

    implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
    

Make sure android X is enabled with gradle.properties and Jetfier enabled

     android.useAndroidX=true
     android.enableJetifier=true

For support versions

   implementation "android.arch.lifecycle:extensions:1.1.1"

This occurs even without Proguard. Today I could create the problem by creating the sample Flutter app in Android Studio and then running 'flutter pub upgrade'.

The solution that worked for me was to add to the app build.gradle file under 'dependencies'

dependencies { ... implementation 'com.android.support:appcompat-v7:28.0.0' }

If your app uses androidx, add to the gradle.properties file:

android.useAndroidX=true android.enableJetifier=true


Do you use Proguard? If so, try to turn it off:

debug {
    minifyEnabled false
    useProguard false
}

Or you can add custom rule to your Proguard config:

-keep class android.arch.** { *; }