【Android】解决aab上传Google Play后下载语言文件缺失的问题

官网(https://developer.android.com/guide/app-bundle?hl=zh-cn)有对aab的描述:

Google Play 会使用您的 App Bundle 针对每种设备配置生成并提供经过优化的 APK,因此只会下载特定设备所需的代码和资源来运行您的应用。

有些手机只内置了中文、英文等几种,如果从Google Play下载应用,那么Google Play会剔除掉其他(它认为是多余的)语言资源文件,从而导致应用切换语言不成功。

解决方法:

gradle那里可以配置是否需要动态分发的内容。

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不进行分包处理,Google Play下载apk后,语言资源文件是完整的。

更多 Android App Bundle的配置,可查看官网文档:

https://developer.android.com/guide/app-bundle/configure-base?hl=zh-cn

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值