Android aab包多语言缺失

2022-09-20  本文已影响0人  itfitness

问题描述

需要上架Google或者华为的aab包后,假如你的应用有多语言切换,有时上架成功后再下载发现切换不了多语言,那是因为在分包的时候导致多语言资源缺失了,这时候需要对app的build.gradle文件进行配置

解决方法

android {
    // When building Android App Bundles, the splits block is ignored.
    splits {...}

    // 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
        }
    }
}

更详细的配置参考:https://developer.android.com/guide/app-bundle/configure-base?hl=zh-cn

上一篇下一篇

猜你喜欢

热点阅读