结论
-DANDROID_STL=c++_shared
- 有该选项 share方式加载STL,打包的so库不含有STD代码
- 没该选项 static方式加载STL。
// 打so库的build.gradle
android {
compileSdkVersion rootProject.android.compileSdkVersion
defaultConfig {
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
}
}
Google相关文档
If your application includes multiple shared libraries, you should use libc++_shared.so.
On Android, the libc++ used by the NDK is not part of the OS. This gives NDK users access to the latest libc++ features and bug fixes even when targeting old versions of Android. The trade-off is that if you use libc++_shared.so, you must in