简体   繁体   English

Android - 调试 AAR 库的本机代码

[英]Android - debug native code of AAR library

I have the following situation.我有以下情况。 Due to some requirements I've to extract some parts of our app into a separate AAR library.由于某些要求,我必须将应用程序的某些部分提取到一个单独的 AAR 库中。 So it looks like that:所以它看起来像这样:

  • Native C++ code together with some Java wrappers is compiled into an AAR library本机 C++ 代码与一些 Java 包装器一起编译成 AAR 库
  • The library is then added as a library module in the main app然后将该库作为库模块添加到主应用程序中

  • The compilation itself is configured with Gradle + CMake编译本身配置了 Gradle + CMake

Everything works as expected but I've one problem, I cannot debug the native C++ part anymore.一切都按预期工作,但我有一个问题,我无法再调试本机 C++ 部分。 Both modules are compiled in DEBUG.这两个模块都是在 DEBUG 中编译的。 It also doesn't help to set the LLDB symbol directory (to LIB_PATH/.externalNativeBuild/cmake/debug/ABI_XXX/CMakeFiles/native-lib.dir/).设置 LLDB 符号目录(到 LIB_PATH/.externalNativeBuild/cmake/debug/ABI_XXX/CMakeFiles/native-lib.dir/)也无济于事。 Setting the LLDB debug type doesn't seem to help either.设置 LLDB 调试类型似乎也没有帮助。

When I put my library code back into the main app I can debug everything without a problem.当我将库代码放回主应用程序时,我可以毫无问题地调试所有内容。

Is it simply not possible to debug the native part of an AAR library?是否根本无法调试 AAR 库的本机部分? Or can anyone tell me what I'm doing wrong?或者谁能​​告诉我我做错了什么?

For some reason I found this blog entry only now...http://www.akaita.com/post/android-native-library-module-debug/出于某种原因,我现在才发现这个博客条目......http://www.akaita.com/post/android-native-library-module-debug/

Although the author is using the experimental ndk plugin I can confirm that it's also working with the stable gradle version + CMake!尽管作者使用的是实验性 ndk 插件,但我可以确认它也适用于稳定的 gradle 版本 + CMake!

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

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