Rich-text Reply

NullPointerException crashes on Android

roman 04-19-15

NullPointerException crashes on Android

Hi,

 

Tried to add some simple events tracking into the app, but it crashes from time to time.

 

Please see stack traces below.

 

Any suggestions?

 

I don't see it locally, but happens frequently for real users.

 

java.lang.NullPointerException
at com.optimizely.Optimizely.trackEvent(Optimizely.java:495)
at *****************************
at android.view.View.performClick(View.java:4439)
at android.view.View$PerformClick.run(View.java:18395)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)

ava.lang.RuntimeException: Unable to resume activity {***********}: java.lang.NullPointerException
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2936)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2965)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2400)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.optimizely.View.idmanager.OptimizelyIdManager.viewMatchesOptimizelyId(OptimizelyIdManager.java:173)
at com.optimizely.View.OptimizelyViews.applyGoalHandlers(OptimizelyViews.java:182)
at com.optimizely.View.OptimizelyViews.applyChanges(OptimizelyViews.java:171)
at com.optimizely.View.OptimizelyViews.onViewsAdded(OptimizelyViews.java:109)
at com.optimizely.View.OptimizelyViews.updateCurrentRootView(OptimizelyViews.java:92)
at com.optimizely.View.OptimizelyViews$OptimizelyLifecycleCallbacks.onActivityResumed(OptimizelyViews.java:368)
at android.app.Application.dispatchActivityResumed(Application.java:174)
at android.app.Activity.onResume(Activity.java:1097)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1190)
at android.app.Activity.performResume(Activity.java:5262)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2923)
... 12 more
Level 1

Re: NullPointerException crashes on Android

Hi Roman,

My name is Josiah and I'm an engineer on our Android team. Thank you so much for beta testing our SDK! I apologize that you are seeing crashes with our SDK in the field. This crash occurs when trackEvent is called when Optimizely is not initialized. This crash has already been fixed in our development branch and will be released with the next version of our SDK (coming very soon).

Please don't hestitate to reach out with any questions or concerns, and thank you again for participating in our Beta!
Optimizely
JEROME539 10-04-15
 

Re: NullPointerException crashes on Android

jchiu85@gmail.com