【Android】解决aab上传Google Play后下载语言文件缺失的问题
官網(wǎng)(https://developer.android.com/guide/app-bundle?hl=zh-cn)有對(duì)aab的描述:
Google Play 會(huì)使用您的 App Bundle 針對(duì)每種設(shè)備配置生成并提供經(jīng)過(guò)優(yōu)化的 APK,因此只會(huì)下載特定設(shè)備所需的代碼和資源來(lái)運(yùn)行您的應(yīng)用。
有些手機(jī)只內(nèi)置了中文、英文等幾種,如果從Google Play下載應(yīng)用,那么Google Play會(huì)剔除掉其他(它認(rèn)為是多余的)語(yǔ)言資源文件,從而導(dǎo)致應(yīng)用切換語(yǔ)言不成功。
解決方法:
gradle那里可以配置是否需要?jiǎng)討B(tài)分發(fā)的內(nèi)容。
android {...// Instead, use the bundle block to control which types of configuration APKs// you want your app bundle to support.bundle {language {// Specifies that the app bundle should not support// configuration APKs for language resources. These// resources are instead packaged with each base and// feature APK.enableSplit = false}density {// This property is set to true by default.enableSplit = true}abi {// This property is set to true by default.enableSplit = true}} }如上,language enableSplit = false代表aab不進(jìn)行分包處理,Google Play下載apk后,語(yǔ)言資源文件是完整的。
更多 Android App Bundle的配置,可查看官網(wǎng)文檔:
https://developer.android.com/guide/app-bundle/configure-base?hl=zh-cn
總結(jié)
以上是生活随笔為你收集整理的【Android】解决aab上传Google Play后下载语言文件缺失的问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: AMD锐龙7 7745HX和i9-129
- 下一篇: 腾讯3轮面试都问了Android事件分发