I have recently switched from ndk-build to cmake build system in Android Studio (I'm using version 3.2.1) and, since I have dependencies in my C++ code to some third party libraries, I've decided to switch to conan C++ package manager to simplify my cross building. In order to do that properly, I've decided to try this on small example just to be sure that everything will work as expected.
I followed instructions from Android studio integration page and everything compiles and runs fine, but I'm unable to debug native code from android studio. My breakpoints in C++ code are ignored.
When I removed all the code dependencies to the libpng library and in the CMakeLists.txt, commented out the
conan_basic_setup(TARGETS)
line I was able to debug C++ code again.
I tried to dig into the "conan_basic_setup" cmake macro, but I got lost inside. I even tried creating debug conan profile for cross compilation by changing
build_type=Release
into
build_type=Debug
in the profile file but without result.
Anyone have the receipt for the correct setup for debugging?
Finally I managed to resolve it by adding parameter NO_OUTPUT_DIRS to the conan_basic_setup macro.
So instead of
conan_basic_setup(TARGETS)
it should be
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
Apparently, without this parameter conan alters the bin/ and lib/ output path and mess the android studio's setup. Now I can debug my code.