如何跟踪本机崩溃

时间:2013-11-19 10:19:20

标签: android

发生了以下崩溃:

java.lang.NullPointerException
at android.view.ViewGroup.resetCancelNextUpFlag(ViewGroup.java:2213)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2139)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1476)
at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2087)
at android.view.View.dispatchPointerEvent(View.java:7535)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3415)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3347)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4456)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4434)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4538)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:125)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:4921)
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:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method) 

正如您所看到的,它没有提及我的应用程序,所以如何处理这些?为min api level 8构建我的应用程序。

我没有重现此错误的步骤。

感谢。

1 个答案:

答案 0 :(得分:0)

您可以使用android log api将日志放入本机代码中,以检查它停止工作的位置。

执行跟踪添加标头到您的C / C ++文件。

  #include <android/log.h>
  #define  LOG_TAG    "NDK"
  #define  NLOG(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)

在Android.mk文件中,请确保在模块中添加以下标志以启用日志记录

  LOCAL_LDLIBS :=-llog

然后您可以像下面的代码一样使用它

  NLOG("bitmap width %d",imagewidth);