I have an anr
in my application after press a button to open an activity that creates a chart for my battery. I never use traces.txt so i don't know what i have to look at in this error:
----- pid 502 at 2013-12-10 14:29:15 -----
Cmd line: com.dd.batterystats
JNI: CheckJNI is off; workarounds are off; pins=0; globals=276
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 SUSPENDED
| group="main" sCount=1 dsCount=0 obj=0x41571ca8 self=0x414ab408
| sysTid=502 nice=0 sched=0/0 cgrp=apps handle=1074172244
| state=S schedstat=( 57059843673 4570148676 34483 ) utm=5671 stm=34 core=1
at org.achartengine.chart.TimeChart.getXLabels(TimeChart.java:~190)
at org.achartengine.chart.XYChart.draw(XYChart.java:314)
at org.achartengine.GraphicalView.onDraw(GraphicalView.java:166)
at android.view.View.draw(View.java:14465)
at android.view.View.getDisplayList(View.java:13362)
at android.view.View.getDisplayList(View.java:13404)
at android.view.View.draw(View.java:14182)
at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
at android.view.View.getDisplayList(View.java:13357)
at android.view.View.getDisplayList(View.java:13404)
at android.view.View.draw(View.java:14182)
at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
at android.view.View.draw(View.java:14468)
at com.android.internal.widget.ActionBarOverlayLayout.draw(ActionBarOverlayLayout.java:381)
at android.view.View.getDisplayList(View.java:13362)
at android.view.View.getDisplayList(View.java:13404)
at android.view.View.draw(View.java:14182)
at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
at android.view.View.draw(View.java:14468)
at android.widget.FrameLayout.draw(FrameLayout.java:472)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2326)
at android.view.View.getDisplayList(View.java:13362)
at android.view.View.getDisplayList(View.java:13404)
at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1570)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1449)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2381)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
where is the line that i have to look at? which is the error!? EDIT: I have update the build path and now i get this error:
12-10 15:30:22.036: E/InputEventReceiver(15922): Exception dispatching input event.
12-10 15:30:22.036: E/AndroidRuntime(15922): FATAL EXCEPTION: main
12-10 15:30:22.036: E/AndroidRuntime(15922): Process: com.dd.batterystats, PID: 15922
12-10 15:30:22.036: E/AndroidRuntime(15922): java.lang.NullPointerException
12-10 15:30:22.036: E/AndroidRuntime(15922): at org.achartengine.chart.XYChart.toRealPoint(XYChart.java:877)
12-10 15:30:22.036: E/AndroidRuntime(15922): at org.achartengine.tools.Pan.apply(Pan.java:74)
12-10 15:30:22.036: E/AndroidRuntime(15922): at org.achartengine.TouchHandler.handleTouch(TouchHandler.java:119)
12-10 15:30:22.036: E/AndroidRuntime(15922): at org.achartengine.GraphicalView.onTouchEvent(GraphicalView.java:300)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.View.dispatchTouchEvent(View.java:7706)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
12-10 15:30:22.036: E/AndroidRuntime(15922): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068)
12-10 15:30:22.036: E/AndroidRuntime(15922): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.app.Activity.dispatchTouchEvent(Activity.java:2458)
12-10 15:30:22.036: E/AndroidRuntime(15922): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2016)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.View.dispatchPointerEvent(View.java:7886)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3954)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3833)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3525)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3426)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3582)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3426)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5602)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5582)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5553)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5682)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5655)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5701)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.Choreographer.doFrame(Choreographer.java:542)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.os.Handler.handleCallback(Handler.java:733)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.os.Handler.dispatchMessage(Handler.java:95)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.os.Looper.loop(Looper.java:136)
12-10 15:30:22.036: E/AndroidRuntime(15922): at android.app.ActivityThread.main(ActivityThread.java:5017)
12-10 15:30:22.036: E/AndroidRuntime(15922): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 15:30:22.036: E/AndroidRuntime(15922): at java.lang.reflect.Method.invoke(Method.java:515)
12-10 15:30:22.036: E/AndroidRuntime(15922): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-10 15:30:22.036: E/AndroidRuntime(15922): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-10 15:30:22.036: E/AndroidRuntime(15922): at dalvik.system.NativeStart.main(Native Method)
You need to learn to read Java stacktraces, it's easy and very useful. I have a small blog post about this, maybe it can be useful to you.
In your second case, the error is
java.lang.NullPointerException
happening at atorg.achartengine.chart.XYChart.toRealPoint(XYChart.java:877)
. This means you have a null reference at that file and that line.