Status/Icon reference https://goo.gl/MLwqIU More info regarding breakpoint cues for native code: https://goto.google.com/ocnfz
Stop the app.
Update the target_link_libraries CMakeLists.txt target_link_libraries( # Specifies the target library. native-lib foo baz
# Links the target library to the log library # included in the NDK. ${log-lib} )
Verify that existing breakpoints are both set to ‘Enabled’
Re-sync gradle, rebuild the app and debug the app
Breakpoint in Foo::getString should be hit Verify:
Create a new project with C++ support with default options.
Create Foo.h and Foo.cpp
1.a Update Foo.h
// start code #include
class Foo { public: Foo() { } std::string getString() const; }; // end code
1.b and update Foo.cpp
// start code #include “Foo.h”
std::string Foo::getString() const { std::string result; result = “I am in Foo”; return result; } // end code
2.a Baz.h // start code #include
class Baz { public: Baz() { } std::string getString() const; }; // end code
2.b Baz.cpp
// start code #include “Baz.h”
std::string Baz::getString() const { std::string result; result = “I am in Baz”; return result; } // end code
add_library( # Sets the name of the library. foo # Sets the library as a shared library. SHARED # Provides a relative path to your source file(s). src/main/cpp/Foo.cpp )
add_library( # Sets the name of the library. baz # Sets the library as a shared library. SHARED # Provides a relative path to your source file(s). src/main/cpp/Baz.cpp )
target_link_libraries( # Specifies the target library. native-lib foo
# Links the target library to the log library # included in the NDK. ${log-lib} )
extern “C” JNIEXPORT jstring JNICALL Java_com_example_kravindran_as_1icon_1cue_MainActivity_stringFromJNI( JNIEnv env, jobject / this */) { std::string hello = “Hello from C++”; const Foo f; hello += " " + f.getString(); return env->NewStringUTF(hello.c_str()); }
Add breakpoints in Foo::getString in Foo.cpp and Baz::getString in Baz.cpp Verify that the breakpoints are both set to ‘Enabled’
Re-sync gradle, rebuild the app and debug the app
Breakpoint in Foo::getString should be hit Verify:
Stop the app.
Update the CMakeLists.txt
target_link_libraries( # Specifies the target library. native-lib foo baz
# Links the target library to the log library # included in the NDK. ${log-lib} )