Debugging NDK
Debugging source code developed with NDK is not as straightforward as debugging code that has been developed with the standard Android Java DK, but there are tools available for this platform. Android Studio provides, since version 1.3, some built-in tools to debug applications with JNI.
In order to prepare an application to be debugged, we need to modify our build.gradle
script. As an example, take the HelloWorldJNI
we have written previously. Open the build.gradle
file of the app
module and add the following lines:
buildTypes { release { minifyEnabled false {…} ndk { debuggable = true } } debug { debuggable = true jniDebuggable = true } }
A new configuration for debugging needs to be created. In order to achieve it, navigate to Edit Configurations, and select New Android Native in the drop-down menu:
When the configuration is released in the Android Native...