android - 为 Android 重新生成 ICU 的 .dat 文件
问题描述
有人决定加拿大应该有 24 小时的默认时间,所以我需要修改我们的 ICU 数据。在 Android 5.1 上,我能够进行“制作”icu4c/source/data
并将结果icudt53l.dat
放入设备中/system/usr/icu.
在 Android 8.1 上,我尝试了相同的方法,但设备无法启动。
09-27 15:12:14.667 E/Zygote ( 8313): System zygote died with exception
09-27 15:12:14.667 E/Zygote ( 8313): java.lang.ExceptionInInitializerError
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.lang.UCharacter.getUnicodeVersion(UCharacter.java:3877)
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.text.StringPrep.<init>(StringPrep.java:277)
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.text.StringPrep.getInstance(StringPrep.java:314)
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.impl.IDNA2003.<clinit>(IDNA2003.java:37)
09-27 15:12:14.667 E/Zygote ( 8313): at java.lang.Class.classForName(Native Method)
09-27 15:12:14.667 E/Zygote ( 8313): at java.lang.Class.forName(Class.java:453)
09-27 15:12:14.667 E/Zygote ( 8313): at com.android.internal.os.ZygoteInit.preloadClasses(ZygoteInit.java:300)
09-27 15:12:14.667 E/Zygote ( 8313): at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:128)
09-27 15:12:14.667 E/Zygote ( 8313): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
09-27 15:12:14.667 E/Zygote ( 8313): Caused by: java.util.MissingResourceException: could not locate data
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.impl.ICUData.getStream(ICUData.java:145)
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.impl.ICUBinary.getData(ICUBinary.java:499)
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.impl.ICUBinary.getRequiredData(ICUBinary.java:453)
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.impl.UCharacterProperty.<init>(UCharacterProperty.java:1221)
09-27 15:12:14.667 E/Zygote ( 8313): at android.icu.impl.UCharacterProperty.<clinit>(UCharacterProperty.java:1437)
09-27 15:12:14.667 E/Zygote ( 8313): ... 9 more
我没有对任何数据文件进行实际更改。结果icudt58l.dat
比看起来不正确的同一文件的提交版本少了约 3k。
有任何想法吗?
解决方案
我的 Android 8.1 源代码也遇到了同样的问题。就我而言,因为在 icudt58l.dat 中没有 ubidi.icu 文件,所以会抛出 MissingResourceException。
在 Makefile 中,ubidi.icu 包含在 UNI_CORE_DATA 中,并且仅构建 ifneq ($(INCLUDE_UNI_CORE_DATA),)。
也就是说,您必须在 make 命令中包含 INCLUDE_UNI_CORE_DATA。
make INCLUDE_UNI_CORE_DATA=1
这是我使用的所有命令:
cd external/icu/icu4c
mkdir build
cd build
../source/runConfigureICU Linux --with-data-packaging=archive
# work around if there is no xlocale.h file in your environment
sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
make INCLUDE_UNI_CORE_DATA=1
adb root; adb remount; adb push ./data/out/icudt58l.dat system/usr/icu/icudt58l.dat
adb shell stop; adb shell start
推荐阅读
- r - 在安全的 R Shiny App 中,如何使“onSessionEnded”仅在应用关闭时触发一次?
- java - Java中列表的动态过滤
- apache-camel - 如何在骆驼简单的xml dsl中使用运算符?
- blazor - 使用一些参数向 RenderFragment 添加另一个小节
- webpack - 如何让 webpack 4 忽略图像 src
- command-prompt - 网络用户命令不显示所有用户
- python - 读入文件路径,然后在 pandas 中打开文件
- javascript - 在 Javascipt 中使用 While 循环的 Pig 拉丁语翻译器
- svelte - Svelte 中的向导架构
- node.js - 是否可以从浏览器连接到 Node.js 的网络模块?