Obsolete
Status Update
Comments
vr...@gmail.com <vr...@gmail.com> #2
We got 18 crashes since last 3 days with the same error.
vr...@gmail.com <vr...@gmail.com> #3
Also, in all the crashes, application was in background.
ad...@google.com <ad...@google.com>
se...@google.com <se...@google.com> #4
Looks like strange bug on samsung. One thing you can't do on your side is to move your app to java8/kotlin and use https://developer.android.com/reference/android/arch/lifecycle/DefaultLifecycleObserver (it is in common-java8 artifact) for all your observers, so you'll never fallback to reflection and never hit this bug
se...@google.com <se...@google.com> #5
Sorry, one thing you CAN DO on your side is to move on java8/kotlin. Sorry for typo
Description
Version used: 1.1.1
Devices/Android versions reproduced on: Samsung devices with Android 5.0, 5.0.1 and 5.0.2 (Some of it)
I am having a library for SDK that extends both Application.ActivityLifecycleCallbacks, LifecycleObserver. In the constructor, I am registering the class as an observer for ProcessLifecycleOwner.
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
For the method that does ON_START work, I have added the following annotation for the same.
@OnLifecycleEvent(Lifecycle.Event.ON_START)
This works completely fine in a local and testing environment. Even for the release version, it works fine. But very rarely it fails with the following error:
Caused by java.lang.NoSuchFieldException: ON_START
at java.lang.Class.getDeclaredField(Class.java:929)
at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:685)
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:663)
at libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:641)
at libcore.reflect.AnnotationAccess.getDeclaredAnnotation(AnnotationAccess.java:170)
at java.lang.reflect.Method.getAnnotation(Method.java:301)
at android.arch.lifecycle.ClassesInfoCache.createInfo(SourceFile:124)
at android.arch.lifecycle.ClassesInfoCache.hasLifecycleMethods(SourceFile:59)
at android.arch.lifecycle.Lifecycling.resolveObserverCallbackType(SourceFile:137)
at android.arch.lifecycle.Lifecycling.getObserverConstructorType(SourceFile:119)
at android.arch.lifecycle.Lifecycling.getCallback(SourceFile:57)
at android.arch.lifecycle.LifecycleRegistry$ObserverWithState.<init>(SourceFile:347)
at android.arch.lifecycle.LifecycleRegistry.addObserver(SourceFile:162)
This error is very rare. I have only seen this happen for Android 5.0, 5.0.1 and 5.0.2 on device Samsung.
I am using android.arch.lifecycle:extensions:1.1.1.
Can someone please help me with this?