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

The native application freezes when starting

我正在开发一个包含本机部分的 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'

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

Is there a way to trace native errors in detail?

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

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

您可以在系统检测到 ANR 情况时找到应用程序所有线程的堆栈跟踪。也许还有一些其他有用的位。即使没有 root 权限也应该可以访问该文件。刚刚 运行:

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