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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15798738/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:19:41  来源:igfitidea点击:

How to debug native code in an Android library project?

androideclipseandroid-ndkjava-native-interface

提问by znat

I am developing an Android library with native code. This library project is added as a library in an application project.

我正在开发一个带有本机代码的 Android 库。该库项目被添加为应用程序项目中的库。

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. 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. Any idea would be greatly appreciated

在应用程序项目中,我刚刚添加了本机代码支持,将构建命令设置为ndk_build NDK_DEBUG=1但它永远不会在断点处停止。任何想法将不胜感激

采纳答案by spacifici

Try the answer by Jay in my question: debug native code in Android library. I had no time to test it by my self, but it looks promising. Let me know if it works.

试试 Jay 在我的问题中的回答:debug native code in Android library。我没有时间自己测试它,但它看起来很有希望。让我知道它是否有效。