Android - debug native code of AAR library

android, c++, debugging, java

Solution

For some reason I found this blog entry only now... 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!

Problem

I have the following situation. Due to some requirements I've to extract some parts of our app into a separate AAR library. So it looks like that: - Native C++ code together with some Java wrappers is compiled into an AAR library The library is then added as a library module in the main app The compilation itself is configured with Gradle + CMake Everything works as expected but I've one problem, I cannot debug the native C++ part anymore. Both modules are compiled in DEBUG. It also doesn't help to set the LLDB symbol directory (to LIB_PATH/.externalNativeBuild/cmake/debug/ABI_XXX/CMakeFiles/native-lib.dir/). Setting the LLDB debug type doesn't seem to help either. 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? Or can anyone tell me what I'm doing wrong?

Original source