栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

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

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/696712.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号