I am trying to make APP native code for Android. The Native code is in cplusplus. Whenever I try to make, the following error appears.
H236Plus.cpp:13
Refer this answer by @Tundebabzy if you are using ndk-build
build system.
For CMake build system
add the following to your module-level build.gradle
file:
android {
...
defaultConfig {
...
externalNativeBuild {
// For ndk-build, instead use ndkBuild {}
cmake {
// Enables exception-handling support.
cppFlags "-fexceptions"
}
}
}
}
...
For more information See this Link.
Just a note for anyone who has started with one of the NDK examples.
They tend to set -fno-exceptions
in their CMakeLists.txt, you need to remove it:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -fno-exceptions -frtti")
You might want to check whether you want -Werror
while you're at it.