Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NDK unable to debug native code with two gradle plugins

I'm using NDK with the experimental gradle plugin, and initially I was able to debug my native code.

Then I saw this issue https://github.com/googlesamples/android-ndk/issues/119 and this blog post http://frogermcs.github.io/json-parsing-with-flatbuffers-in-android/. This approach would be great, because I could use the stable gradle plugin for android specific code, and the experimental gradle plugin for the native code, witch would be great to use use databinding for example. I was able to use this structure, but I lost the ability to debug native code.

I have created a sample project that illustrate my problem. https://github.com/4brunu/AndroidNDKDebug

In there you can find two projects. The first one "hello-jni-one-gradle-plugin", only use the experimental gradle plugin, and I'm able to debug the native code. The second one "hello-jni-two-gradle-plugins", I use the stable gradle plugin for android specific code, and the experimental gradle plugin for the native code, and I'm unable to debug the native code.

Am I doing something wrong? Could you help me enable native code debug in the second project please?

Thanks

like image 347
Bruno Coelho Avatar asked Apr 07 '16 09:04

Bruno Coelho


1 Answers

I'm using the same setup in one of my projects, with Android Studio 2.1-preview5, gradle-experimental 0.7.0-alpha5, and gradle plugin 2.1.0-alpha5, and debugging works.

The secret missing step is to add the path to your non-stripped libs to the debugger: lib/build/intermediates/binaries/release/obj/ABI

ndk debug symbol directories

like image 196
ph0b Avatar answered Nov 08 '22 15:11

ph0b