Code Bye

Android运行错误

06-07 07:38:05.068: D/gralloc_goldfish(535): Emulator without GPU emulation detected.
06-07 07:41:30.578: D/AndroidRuntime(535): Shutting down VM
06-07 07:41:30.578: W/dalvikvm(535): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
06-07 07:41:30.598: E/AndroidRuntime(535): FATAL EXCEPTION: main
06-07 07:41:30.598: E/AndroidRuntime(535): java.lang.NullPointerException
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.bottle.stockmanage.DBUtil.getAllInfo(DBUtil.java:45)
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.bottle.stockmanage.MainActivity.setListView(MainActivity.java:159)
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.bottle.stockmanage.MainActivity.access$1(MainActivity.java:153)
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.bottle.stockmanage.MainActivity$1.onClick(MainActivity.java:46)
06-07 07:41:30.598: E/AndroidRuntime(535):  at android.view.View.performClick(View.java:3480)
06-07 07:41:30.598: E/AndroidRuntime(535):  at android.view.View$PerformClick.run(View.java:13983)
06-07 07:41:30.598: E/AndroidRuntime(535):  at android.os.Handler.handleCallback(Handler.java:605)
06-07 07:41:30.598: E/AndroidRuntime(535):  at android.os.Handler.dispatchMessage(Handler.java:92)
06-07 07:41:30.598: E/AndroidRuntime(535):  at android.os.Looper.loop(Looper.java:137)
06-07 07:41:30.598: E/AndroidRuntime(535):  at android.app.ActivityThread.main(ActivityThread.java:4340)
06-07 07:41:30.598: E/AndroidRuntime(535):  at java.lang.reflect.Method.invokeNative(Native Method)
06-07 07:41:30.598: E/AndroidRuntime(535):  at java.lang.reflect.Method.invoke(Method.java:511)
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-07 07:41:30.598: E/AndroidRuntime(535):  at dalvik.system.NativeStart.main(Native Method)
解决方案

5

空指针
MainActivity.java:159
MainActivity.java:156
MainActivity.java:43

5

行数

10

06-07 07:41:30.598: E/AndroidRuntime(535):  at com.bottle.stockmanage.MainActivity.setListView(MainActivity.java:159)
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.bottle.stockmanage.MainActivity.access$1(MainActivity.java:153)
06-07 07:41:30.598: E/AndroidRuntime(535):  at com.bottle.stockmanage.MainActivity$1.onClick(MainActivity.java:46)
对应的Java文件的对应行去找,空指针

10

at com.bottle.stockmanage.DBUtil.getAllInfo(DBUtil.java:45)
你的DBUtil类里面的getAllInfo()方法有错

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Android运行错误