In the Customize C++ Support section of the wizard, you can customize your project with the following options:
C++ Standard: use the drop-down list to select which standardization of C++ you want to use. Selecting Toolchain Default uses the default CMake setting.
Exceptions Support: check this box if you want to enable support for C++ exception handling. If enabled, Android Studio adds the -fexceptions flag to cppFlags in your module-level build.gradle file, which Gradle passes to CMake.
Runtime Type Information Support: check this box if you want support for RTTI. If enabled, Android Studio adds the -frtti flag to cppFlags in your module-level build.gradle file, which Gradle passes to CMake.123456
/**
* Created by bdliang on 17-12-12.
*/public class MyLib {
static { //加载so 文件
System.loadLibrary("math");
} public native int add(int para1, int para2);
}123456789101112131415
cmake_minimum_required(VERSION 3.4.1)add_library( # Sets the name of the library. so库名字
math # Sets the library as a shared library.
SHARED # 具体的C++ 文件
src/main/jni/Math.cpp
)find_library( # Sets the name of the path variable.
log-lib # Specifies the name of the NDK library that
# you want CMake to locate.
log )target_link_libraries( # Specifies the target library.
math # Links the target library to the log library
# included in the NDK.
${log-lib} )123456789101112131415161718192021222324252627282930