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

前端 未结 3 1210
刺人心
刺人心 2021-02-06 04:07

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++ c

3条回答
  •  我在风中等你
    2021-02-06 04:50

    I had the similar issue with my own libraries some months ago because I thought that if I added the -g (gcc) flag it would generate the debug symbols, as the desktop (linux, unix kernel) apps.

    But, actually it does not work to generate debug symbols.

    I see that you use Cmake as a external build tool and clang compiler.

    So in my case I configure my cmake script with gcc but out of gradle scripting, but I think it will be the same, I add -mapcs-frame in the CMAKE_CXX_FLAGS.

    externalNativeBuild {
            cmake {
                arguments "-DANDROID_PLATFORM_LEVEL=${11}",
                        '-DANDROID_TOOLCHAIN=gcc', 
                        '-DANDROID_STL=gnustl_static',
                        'DCMAKE_CXX_FLAGS=-mapcs-frame'
            }
        }
    

    I know that if you use clang compile may be this flag could not work. But my idea was to share my experience with android native debugging.

    I Hope this clues could help you.

    Cheers.
    Unai.

提交回复
热议问题