Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choreographer NullPointerException

I've been working on an existing codebase for a while and from browsing our crash log service I've noticed an exception that happens pretty frequently, I am not able to reproduce this issue, nor do I have the context for the scenario to try and dig in, as this is a pretty big project it has become increasingly hard to find out the cause of this exception.

I have been searching online for similar issues and couldn't find any useful information. If anyone is familiar with this issue, your help would be greatly appreciated.

Stacktrace is as follows:

java.lang.NullPointerException
   at android.animation.PropertyValuesHolder.setupSetterAndGetter(PropertyValuesHolder.java:505)
   at android.animation.ObjectAnimator.initAnimation(ObjectAnimator.java:487)
   at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:517)
   at android.animation.ValueAnimator.start(ValueAnimator.java:936)
   at android.animation.ValueAnimator.start(ValueAnimator.java:946)
   at android.animation.ObjectAnimator.start(ObjectAnimator.java:465)
   at android.animation.AnimatorSet$1.onAnimationEnd(AnimatorSet.java:579)
   at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1056)
   at android.animation.ValueAnimator.access$400(ValueAnimator.java:50)
   at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:644)
   at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:660)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
   at android.view.Choreographer.doFrame(Choreographer.java:543)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5105)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
   at dalvik.system.NativeStart.main(NativeStart.java)

Cheers.

like image 823
woot Avatar asked Jun 08 '14 11:06

woot


3 Answers

The issue turned out to be an animation being invoked from a Handler using postDelayed(), which eventually resulted in attempting to animate a null View reference, since it wasn't cleared properly according to it's host lifecycle events.

like image 89
woot Avatar answered Nov 04 '22 16:11

woot


maybe you tagret is null, print log with animatorSet.getTarget() to see

like image 42
Raul Yang Avatar answered Nov 04 '22 16:11

Raul Yang


I also get this stack trace when I use : ObjectAnimator animator = ObjectAnimator.ofFloat(this, "scale", 1); .... animator.start()

run in android 4.0.X, but it's ok for higher version, you can also refer this guy's commit, though I don't how to fix, however this is the root cause definitely.

like image 32
jiangyan.lily Avatar answered Nov 04 '22 17:11

jiangyan.lily