Include ICU in Android NDK Project(在 Android NDK 项目中包含 ICU)
问题描述
I built a library in C++ that I want to include in my Android application using the NDK. However, my library needs to use ICU4C. I have been trying to compile ICU for Android, and I looked at a lot of questions here on SO, but I am still unable to get ICU compiled into .a files for Android. I'm not sure the best way to do this. Has anyone had success with ICU with the NDK?
By the way, I was hoping to use ICU 51.2, unless there's a good reason to use an older version.
You can build ICU as Android static library by specifying these flags in your Android.mk
LOCAL_CFLAGS := -DANDROID -fdata-sections -ffunction-sections
LOCAL_CPPFLAGS := -DANDROID -frtti -fno-exceptions -fdata-sections -ffunction-sections
If you use Android NDK without exceptions you will need to hack the missing cxa_bad_typeid()
extern "C" std::type_info const& __cxa_bad_typeid()
{
// just return something
return typeid(void*);
}
这篇关于在 Android NDK 项目中包含 ICU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Android NDK 项目中包含 ICU


- 如何提取 __VA_ARGS__? 2022-01-01
- 将 hdc 内容复制到位图 2022-09-04
- 哪个更快:if (bool) 或 if(int)? 2022-01-01
- XML Schema 到 C++ 类 2022-01-01
- DoEvents 等效于 C++? 2021-01-01
- 使用 __stdcall & 调用 DLLVS2013 中的 GetProcAddress() 2021-01-01
- 将函数的返回值分配给引用 C++? 2022-01-01
- 从父 CMakeLists.txt 覆盖 CMake 中的默认选项(...)值 2021-01-01
- GDB 不显示函数名 2022-01-01
- OpenGL 对象的 RAII 包装器 2021-01-01