NoClassDefFoundError Landroid/arch/lifecycle/LifecycleDispatcher

前端 未结 3 1747
慢半拍i
慢半拍i 2020-12-20 18:32

I want to try out the new lifecycle stuff from google (https://developer.android.com/arch) but getting a crash on app open. All I have done is add the dependencies. Is anyon

相关标签:
3条回答
  • 2020-12-20 18:56

    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

    0 讨论(0)
  • 2020-12-20 19:01

    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

    0 讨论(0)
  • 2020-12-20 19:14

    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.** { *; }
    
    0 讨论(0)
提交回复
热议问题