-1

我无法在 android 版本 4.0 的手机中运行我的应用程序。但我可以在手机 android 2.3 上运行我的应用程序。

这是日志猫:

10-25 11:58:59.505: D/dalvikvm(23464): GC_FOR_ALLOC freed 117K, 12% free 9492K/10759K, paused 13ms, total 16ms
10-25 11:58:59.515: D/AndroidRuntime(23464): Shutting down VM
10-25 11:58:59.515: W/dalvikvm(23464): threadid=1: thread exiting with uncaught exception (group=0x417692a0)
10-25 11:58:59.515: E/AndroidRuntime(23464): FATAL EXCEPTION: main
10-25 11:58:59.515: E/AndroidRuntime(23464): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.monitoringapp/com.example.monitoringapp.MainActivity}: java.lang.NullPointerException: println needs a message
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.ActivityThread.access$700(ActivityThread.java:140)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.os.Looper.loop(Looper.java:137)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.ActivityThread.main(ActivityThread.java:4921)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at java.lang.reflect.Method.invokeNative(Native Method)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at java.lang.reflect.Method.invoke(Method.java:511)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at dalvik.system.NativeStart.main(Native Method)
10-25 11:58:59.515: E/AndroidRuntime(23464): Caused by: java.lang.NullPointerException: println needs a message
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.util.Log.println_native(Native Method)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.util.Log.e(Log.java:297)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at com.example.monitoringapp.PrinterObject.<init>(PrinterObject.java:75)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at com.example.monitoringapp.MainActivity.onCreate(MainActivity.java:54)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.Activity.performCreate(Activity.java:5206)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
10-25 11:58:59.515: E/AndroidRuntime(23464):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
10-25 11:58:59.515: E/AndroidRuntime(23464):    ... 11 more

基本上,我的应用程序在服务上运行以刷新 UI 的更新。我不知道是什么原因导致我的 android 版本 4.0 的应用程序出现问题。在电话中,它说“不幸的是,……已经停止了。” 有人知道吗?

4

2 回答 2

0

In your MainActivity. you are printing some data like:

Systom.out.println(data);

this data is null. put try/catch or solve the reason of being null.

In logcat: MainActivity}: java.lang.NullPointerException: println needs a message 10-25 11:58:59.515: E/AndroidRuntime(23464): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)

于 2013-10-25T10:21:31.817 回答
0

使用AsyncTask. 您可能正在cpu主线程中执行一些下载任务或其他密集任务。将其移至AsyncTask.

于 2013-10-25T10:22:31.090 回答