应用程序在设备上以NullPointerException启动

时间:2015-12-21 14:39:48

标签: android nullpointerexception crash

我做了一个新的构建(周末之后),我的应用程序崩溃,下面的例外情况。有趣的是,我上周使用相同的配置进行了构建,没有任何代码更改,然后就可以了。该应用程序在模拟器上运行良好,但在我的三星Galaxy Tab 2 10.1抛出异常。 我正在使用Android Studio 1.5.1。有人面临同样的问题吗?

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)

1 个答案:

答案 0 :(得分:5)

我找到了问题的解决方案,但我不知道它为什么会正常工作。我将android v4 support library的版本从23.0.0增加到23.1.1,应用程序没有崩溃。