java icu4j,icu4j太大了,有什么选择吗?

I am using icu4j in my android code. The jar is about 10MB, which causes my entire application to register an apk of 15MB. Of course the 15MB is likely due to Proguard helping reducing the size. Anyway, does anyone know of a smaller alternative to icu4j? I am using icu4j in conjunction with libphonenumber for one purpose only, which is detailed here, and which I reproduce below:

You need:

getSupportedRegions() to get the list of region codes

getCountryCodeForRegion(regionCode) to get the country calling code for each one (1, 44 etc)

And then to get the actual names, you should use ICU4J ->

http://icu-project.org/apiref/icu4j/ --> it will get you country names

from these region codes in whatever language your user speaks.

(getDisplayCountry())

解决方案

As of Android 7.0 (API 24), the ICU framework is exposed so that you don't need to include the library separately in your app. The documentation recommends creating multiple versions of your APK if you need to include it in earlier Android versions.

Of course, if you only need it for one small thing, then it would be better to find a native Android or Java API that can do the job, or some smaller third-party library.

Note

With some work it may be possible to edit the ICU library to be significantly smaller. See this page for more details.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值