在 Android 库中调试本机代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12638849/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Debug native code in Android Library
提问by spacifici
My workspace layout is:
我的工作区布局是:
.
├── ApplicationLibrary
│?? ├── AndroidManifest.xml
│?? ├── ...
│?? ├── jni
│?? ├── libs
│?? ├── ...
│?? └── src
└── Application
?? ├── AndroidManifest.xml
?? ├── ant.properties
?? └── ...
How can I debug the native library in Eclipse? Has anyone some hint about this?
如何在 Eclipse 中调试本机库?有人对此有所暗示吗?
采纳答案by Jay
I was able to set breakpoints and debug native code in an android library on eclipse by adding the directory of the unstripped shared library/libraries to the debugger in the debug configurations dialog:
通过将未剥离的共享库/库的目录添加到调试配置对话框中的调试器,我能够在 Eclipse 上的 android 库中设置断点和调试本机代码:
- Go to "Run" menu-> "Debug Configurations"
- Under "Android Native Application" in the left pane, select your application
- Under the "Debugger" tab click "Add..." in the "Shared Libraries" section.
- Browse to your android library project directory and add its subdirectory obj/local/armeabi.
- Apply and debug.
- 转到“运行”菜单->“调试配置”
- 在左窗格中的“Android Native Application”下,选择您的应用程序
- 在“调试器”选项卡下,单击“共享库”部分中的“添加...”。
- 浏览到您的 android 库项目目录并添加其子目录 obj/local/armeabi。
- 应用和调试。
That seemed to work for me. Hopefully, you'll have the same luck...
这似乎对我有用。希望你也有同样的运气...
Peace
和平
回答by RDX
It is possible:
有可能的:
Update your build config to include “NDK_DEBUG = 1”. Right click project -> properties -> C/C++ Build:
Set a breakpoint in your C code.
Right click on your project, select Debug As -> Android Native Application
更新您的构建配置以包含“NDK_DEBUG = 1”。右键单击项目 -> 属性 -> C/C++ Build:
在 C 代码中设置断点。
右键单击您的项目,选择 Debug As -> Android Native Application
For more details follow:
更多详情请关注: