简体   繁体   English

调试Android库中的本机代码

[英]Debug native code in Android Library

My workspace layout is: 我的工作区布局是:

.
├── ApplicationLibrary
│   ├── AndroidManifest.xml
│   ├── ...
│   ├── jni
│   ├── libs
│   ├── ...
│   └── src
└── Application
    ├── AndroidManifest.xml
    ├── ant.properties
    └── ...

How can I debug the native library in Eclipse? 如何在Eclipse中调试本机库? Has anyone some hint about this? 有人暗示过这个吗?

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库中设置断点和调试本机代码:

  1. Go to "Run" menu-> "Debug Configurations" 转到“运行”菜单 - >“调试配置”
  2. Under "Android Native Application" in the left pane, select your application 在左侧窗格的“Android Native Application”下,选择您的应用程序
  3. Under the "Debugger" tab click "Add..." in the "Shared Libraries" section. 在“调试器”选项卡下,单击“共享库”部分中的“添加...”。
  4. Browse to your android library project directory and add its subdirectory obj/local/armeabi. 浏览到您的android库项目目录并添加其子目录obj / local / armeabi。
  5. Apply and debug. 应用和调试。

That seemed to work for me. 这似乎对我有用。 Hopefully, you'll have the same luck... 希望你能有同样的运气......

Peace 和平

It is possible: 有可能的:

  1. Update your build config to include “NDK_DEBUG = 1”. 更新您的构建配置以包含“NDK_DEBUG = 1”。 Right click project -> properties -> C/C++ Build: 右键单击项目 - >属性 - > C / C ++ Build:

  2. Set a breakpoint in your C code. 在C代码中设置断点。

  3. Right click on your project, select Debug As -> Android Native Application 右键单击您的项目,选择Debug As - > Android Native Application

For more details follow: 有关详情,请访问:

http://tools.android.com/recent/usingthendkplugin http://tools.android.com/recent/usingthendkplugin

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

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