ICU4J is an open-source, widely used set of Java libraries providing Unicode
and globalization support for software applications. Starting in Android 7.0
(API level 24), Android
exposes a subset of the ICU4J APIs for app developers
to use under the
android.icu package. These APIs use
localization data present on the device. As a result, you can reduce your APK
footprint by not compiling the ICU4J libraries into your APK; instead, you can
simply call out to them in the framework. (In this case, you may want to provide
of your APK, so users running versions of Android lower than
Android 7.0 (API level 24)
can download a version of the app that contains the ICU4J libraries.)
This document begins by providing some basic information on the minimum Android API levels required to support these libraries. It then explains what you need to know about the Android-specific implementation of ICU4J. Finally, it tells you how to use the ICU4J APIs in the Android framework.
Relationship to ICU4J
Android exposes a subset of the ICU4J APIs via the
android.icu package, rather than
Android framework may choose not to
expose ICU4J APIs for various reasons; for example, Android does not expose
some deprecated APIs or those that the ICU team have not yet declared as
stable. As the ICU team deprecates APIs in the future, Android will also mark
them as deprecated but will continue to include them.
|Android API level||ICU version||CLDR version|
|Android 7.0 (API level 24), Android 7.1 (API level 25)||56||28|
Here are a few important things to note:
- The ICU4J Android framework APIs do not include all the ICU4J APIs.
- NDK developers should know that Android ICU4C is not supported.
- The APIs in the Android framework do not replace Android’s support for localizing with resources.
Migrating to the android.icu package from com.ibm.icu
If you are already using the ICU4J APIs in your app, and the
android.icu APIs meet your requirements, then migrating to
the framework APIs requires you to change your Java imports
android.icu. You may then
remove your own copy of ICU4J files from the APK.
Note: The ICU4J framework APIs use the
namespace instead of
com.ibm.icu. This is to avoid namespace
conflicts in APKs that contain their own
Migrating to android.icu APIs from other Android SDK APIs
Some classes in the
android packages have
equivalents to those found in ICU4J. However, ICU4J often provides broader
support for standards and languages.
Here are some examples to get you started:
ICU4J is released under the ICU license. For details, see the ICU User Guide.