Thursday, 11 February 2021

Android: NDK-Build C/C++ debug in android studio

Trying ndk-build C code debug in Android studio(v4.1.2).Below is build.gradle setup.

  1. jni , C/C++ Source files Dirs. Actual C files are not under jni folder but outside it but referred in android.mk file.

    sourceSets.main.jniLibs.srcDirs = ['D:/ccodefolder/jni/']

2)Android.mk Builds a shared library from C , c++ code and also links inbuilt shared and static libraries.

 externalNativeBuild {
           ndkBuild {
               path file('D:/ccodefolder/jni/Android.mk')
           }
       }
       ndkVersion '21.1.6352462'
    debug {
            debuggable true
            jniDebuggable true
            minifyEnabled false
            shrinkResources false
           //ndk.debugSymbolLevel = 'FULL'
        }
    

    4)Project structure is as in the image.

    enter image description here

    Able to run the project and shared library get generated along with other prebuilt .SOs and apk works, also CPP folder is created and able to see C code files of my project.

    DEBUGGING ISSUE:

    LLDB server gets started and Debugger attached to process, But debug any C file is failing with below error.

    Breakpoint will not currently be hit. No executable code is associated with this line

    enter image description here

    Thanks



    from Android: NDK-Build C/C++ debug in android studio

    No comments:

    Post a Comment