解决android strings product值引起的复写字串不起效问题
【问题描述】
android/packages/apps/Settings/res/values/strings.xml里面有字串
<string name="sd_format_summary" product="default">Erases all data on the SD card, such as music and photos</string>
现通过overlay文件夹(DEVICE_PACKAGE_OVERLAYS)下的“同路径”文件
android/device/xxx/overlay/packages/apps/Settings/res/values/strings.xml
修改上述字串,
<string name="sd_format_summary" product="default">Erases2 all data on the SD card, such as music and photos</string>
重新构建Settings.apk,push进机器,未起作用。
【分析】
两个文件的product属性值均为default,系统未用overlay下的同名字串进行替换,未进行替换的原因需要深入分析android编译系统;项目中有以下配置:
PRODUCT_CHARACTERISTICS := tablet
即,如果存在product为tablet的资源,则选择之,否则选择default,故,将overlay下的字串按以下编写后,即可生效。
<string name="sd_format_summary" product="tablet">Erases2 all data on the SD card, such as music and photos</string>
或者
<string name="sd_format_summary">Erases2 all data on the SD card, such as music and photos</string>