在 Android 设备上调试

您可以使用 LLDB 在使用 Qt 5.15.9 或更高版本和 Qt 6.2 或更高版本开发的 Android 设备上调试应用程序。

最近发布的Qt Creator 在 Android 上使用 LLDB 调试 Native (C++) 时存在问题。

Qt Creator 17.0.1 已修复了这一问题。要修复早期版本中的问题,请访问首选项>Debugger >GDB ,然后在Additional Attach Commands 中添加以下内容。

settings set plugin.jit-loader.gdb.enable off

调试器首选项中的 GDB 选项卡

在不同的 Android 设备上启用调试的方式不同。在Developer Options 下查找USB Debugging 。在Settings >About 中多次点击Build number ,显示Developer Options

选择调试构建配置,以构建用于调试的应用程序。

注意: 如果运行 Android Studio,Qt Creator 无法调试 Android 设备上的应用程序。如果应用程序输出中出现以下信息,请关闭 Android Studio 并重试:

Ignoring second debugger -accepting and dropping.

另请参阅 如何:为 Android 开发为 Android 开发配置设备上的开发人员选项

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.