I am using FullLifecycleObserver in my project since long time but lately after updating my App's Android Gradle Plugin to 7.0.2, I am getting the following crash .
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.demo, PID: 463
java.lang.IllegalAccessError: Interface androidx.lifecycle.FullLifecycleObserver implemented by class com.myapp.AndroidXLifecycle$Wrapper is inaccessible (declaration of 'com.myapp.AndroidXLifecycle$Wrapper' appears in /data/app/~~7rat7QSnMLMmpeTBuQ9x4Q==/com.example.demo-NJOtI6dh-fR3aEGN-YGrjg==/base.apk)
On further digging I found that Flutter developers have also faced this issue and declaring changes in Proguard file would work for them like the one below :
-keep class androidx.lifecycle.FullLifecycleObserver
But that did not make any difference as well.
Is there any solution to this other than downgrading gradle plugin version ?