Gex Gex - 3 months ago 11
Android Question

App start with NullPointerException on device

I made a fresh build (after the weekend) and my app crashed with the exception below. The interesting part is, that I made a build last week with the same configuration without any code changes and it worked then. The app works well on emulator, but on my Samsung Galaxy Tab 2 10.1 throws exception.
I'm using Android Studio 1.5.1. Is somebody faced with a same issue?

12-21 14:19:27.359 6142-6142/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException
at android.view.View.getHardwareLayer(View.java:10225)
at android.view.ViewGroup.drawChild(ViewGroup.java:2863)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:11028)
at android.view.View.getDisplayList(View.java:10464)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:11028)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at android.view.View.getDisplayList(View.java:10464)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:840)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1923)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1647)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2459)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4514)
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:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)

Gex Gex
Answer

I found a solution for the problem, but I don't know why is it exactly working. I increased the version of the android v4 support library from 23.0.0 to 23.1.1 and the app didn't crashed.