本机应用程序在启动时会冻结

时间:2016-11-22 11:17:11

标签: android android-ndk android-debug android-anr-dialog

我正在开发一个包含原生部分的Android应用程序。我无法调试本机部分,它不会给出任何错误。在我等待一段时间后,当我启动应用程序时,它会发出以下警告,但它不会崩溃,只是冻结和等待。

V/ActivityThread: Handling launch of ActivityRecord{5b69371 token=android.os.BinderProxy@a0f6556 {com.mcg.realtimeaudiosynthesis/com.mcg.realtimeaudiosynthesis.MainActivity}}
D/MessageLogger: >>> Entering MessageLogger.dump. to Dump MSG HISTORY <<<
D/MessageLogger: MSG HISTORY IN MAIN THREAD:
                 Current kernel time : 9189711ms
                 Last record : Msg#:4 >>>>> Dispatching to Handler (android.app.ActivityThread$H) {377158fb} null: 100
                 Last record dispatching elapsedTime:8085 ms/upTime:8086 ms
                 Last record dispatching time : 2016-11-22 14:00:52.839
                 Msg#:3 <<<<< Finished to Handler (android.app.ActivityThread$H) {377158fb} null elapsedTime:14 ms/upTime:14 ms
                 Msg#:2 >>>>> Dispatching to Handler (android.app.ActivityThread$H) {377158fb} null: 110 from 2016-11-22 14:00:52.825
                 Msg#:1 <<<<< Finished to Handler (android.app.ActivityThread$H) {377158fb} null elapsedTime:0 ms/upTime:1 ms
                 Msg#:0 >>>>> Dispatching to Handler (android.app.ActivityThread$H) {377158fb} null: 138 from 2016-11-22 14:00:52.824
                 === Finish Dumping MSG HISTORY===
                 === LONGER MSG HISTORY IN MAIN THREAD ===
                 === Finish Dumping LONGER MSG HISTORY===
D/MessageQueue: Dump first 20 messages in Queue: 
D/MessageQueue: Dump Message in Queue (1): { when=-7s725ms what=149 obj=android.os.BinderProxy@a0f6556 target=android.app.ActivityThread$H obj=android.os.BinderProxy@a0f6556 }
D/MessageQueue: Total Message Count: 1
I/art: Thread[9,tid=4357,WaitingInMainSignalCatcherLoop,Thread*=0xb3906400,peer=0x12c40080,"Signal Catcher"]: reacting to signal 3
I/art: Wrote stack traces to '/data/anr/traces.txt'

在调试器上,调试在几步后消失,但我仍然连接。有没有办法详细跟踪本机错误?

1 个答案:

答案 0 :(得分:1)

  

有没有办法详细跟踪本机错误?

对于您的特定情况,您可以获得更多信息。您的应用已进入 ANR (应用无响应)状态,此处:

I/art: Wrote stack traces to '/data/anr/traces.txt'

在系统检测到ANR条件时,您可以找到应用程序所有线程的堆栈跟踪。也许还有其他一些有用的东西。即使没有root权限,也应该可以访问此文件。跑吧:

$ adb shell "cat /data/anr/traces.txt"