简体   繁体   English

如何在Android库项目中调试本机代码?

[英]How to debug native code in an Android library project?

I am developing an Android library with native code. 我正在开发一个包含本机代码的Android库。 This library project is added as a library in an application project. 此库项目作为库添加到应用程序项目中。

I would like to debug the library when the application project is using it. 我想在应用程序项目使用它时调试库。

I am pretty sure the settings in the library (makefiles, build command, compiler options) project are ok because I tried the debugger from within the library (I created a dummy Activity and unset "library") and it worked. 我很确定库(makefile,build命令,编译器选项)项目中的设置是可以的,因为我在库中尝试了调试器(我创建了一个虚拟Activity并取消设置“库”)并且它工作正常。 I am also aware of the delay that might occur because of the time needed to load the dynamic library and I don't think it's the issue for the same reason. 我也知道由于加载动态库所需的时间而可能发生的延迟,我不认为这是因为同样的原因。

In the Application project, I just added native code support set the build command as ndk_build NDK_DEBUG=1 , but it never stops at breakpoints . 在Application项目中,我只是添加了本机代码支持,将build命令设置为ndk_build NDK_DEBUG=1但它永远不会在断点处停止 Any idea would be greatly appreciated 任何想法将不胜感激

Try the answer by Jay in my question: debug native code in Android library . 在我的问题中尝试Jay的答案: 调试Android库中的本机代码 I had no time to test it by my self, but it looks promising. 我没有时间亲自测试它,但看起来很有希望。 Let me know if it works. 如果有效,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM