[FIXED] Debugging C++/native library modules not working with Android Studio (Cmake used)


I’m having trouble debugging C++ files of my library module.

Is this possible in general?

The debugging works fine if the application project contains the c++ code.
But I want to move the C++ Code to a library module.

The Error Message while starting the session:

Now Launching Native Debug Session

Attention! No symbol directories found – please check your native debug configuration

gradle file of my lib:

apply plugin: 'com.android.library'

android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {

    minSdkVersion 16
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
    externalNativeBuild {
        cmake {
            arguments "-DANDROID_PLATFORM_LEVEL=${11}",
                    '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static'
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
externalNativeBuild {
    cmake {
        path "CMakeLists.txt"

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:24.2.0'

In the run configuration the debugger is set to auto

enter image description here


Im using:

Gradle : 2.2.3

Android Studio : 2.2.3

in the LLLB Console, i checked the breakpoint List with:

breakpoint list -v

all my checkpoints are listed there.

Not Working Breakpoint

1: file = 'C:\android-dev\...\test.cpp', line = 19, exact_match = 0

..thats all

Working Breakpoint

1: file = 'C:\android-dev\...\test.cpp', line = 19, exact_match = 0
      module = C:\android-dev\...\test.so
      compile unit = gl_code.cpp
      function = testFunc(..)
      location = C:\android-dev\...\test.cpp:16
      address = 0x0000007f871d068c
      resolved = true
      hit count = 1   


The reason seems to be, that a release version of the lib is created,
which does not support debugging, even if the app is built with debug options.


To solve this issue, do the following workaround. It ensures that a debug version is built.

In your apps build.gradle change:

compile project(':nativelib')


compile project(path: ':nativelib' , configuration: 'debug')

In the libs build.gradle add:

android {

    publishNonDefault  true //this line

    compileSdkVersion 24
    buildToolsVersion "25.0.2"
    defaultConfig {


See the google issue for updates:


Answered By – daemmie

Answer Checked By – Mary Flores (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published