Android Studio NDK“来自 C 的你好”项目无法调试(无法设置断点)?
Android Studio是BumbleBee 2021.1.1 Path 2,刚刚新建了一个Native C++项目,Build菜单|编辑Build Types,点击debug,jni Debuggable选择“true”,运行|编辑配置,调试器选项卡,选择“Native only”,在native-lib.cpp中,设置断点,然后运行|调试应用程序,断点不会被命中!
我在两台电脑上测试过,遇到同样的问题。还有什么需要做的吗?
编辑: 如果在 debugger 选项卡中选择“Dual”,Kotlin 中的断点是可以的,参见图 4。但是 native-lib.cpp 中的断点仍然没有命中。
Android Studio is BumbleBee 2021.1.1 Path 2, just new a Native C++ project, the Build menu | Edit Build Types, click debug, jni Debuggable selects "true", the Run | Edit configuration, Debugger tab, selects "Native only", in native-lib.cpp, set a breakpoint, then Run | Debug app, the breakpoint will not be hit!
I have tested these in two computers, meet the same problem. Is there anything more need to do?
Edit:
If selects "Dual" in debugger tab, The breakpoint in Kotlin is OK, see pic 4. but the breakpoint in native-lib.cpp still does not be hit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
更新 android studio 以预览版本 Dolphin (2021.3.1) Canary 7
Update android studio to preview release Dolphin (2021.3.1) Canary 7
您可以尝试将 project("myapplication") 添加到 cmakelist 并将 gradle 升级到 7.1.2。
You can try to add project("myapplication") to cmakelist and upgrade gradle to 7.1.2.
我在 Electric Eel 2022.1.1 中遇到了同样的问题,唯一有帮助的是进入 jni 函数,然后在调试器视图中的 LLDB 命令行上设置断点,例如:
有趣的是,之后我可以在该行的编辑器也是如此。
I have the same issue in Electric Eel 2022.1.1 and the only thing that helps is to step in the jni function and then set the breakpoint on the LLDB command line in the debugger view like:
Interestingly enough, afterwards I can set the breakpoint in the editor for that line as well.