包括在Android的NDK项目ICU [英] Include ICU in Android NDK Project

查看:707
本文介绍了包括在Android的NDK项目ICU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建在C ++库,我想在我的使用NDK的Andr​​oid应用程序,包括。然而,我的图书馆需要使用ICU4C。
我一直在试图编译ICU为Android,我看了很多在这里做题,但我仍然无法得到ICU编译成Android的.a文件。我不知道这样做的最佳方式。
有没有人有成功与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?

顺便说一句,我希望用ICU 51.2,除非有充分的理由来使用旧版本。

By the way, I was hoping to use ICU 51.2, unless there's a good reason to use an older version.

推荐答案

您可以通过在 Android.mk

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

如果您使用Android NDK没有例外,您将需要破解缺少 cxa_bad_typeid()

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆