0

My project is an application that supports In-App Language Switching. The app bundle I packaged can be installed directly through the bundletool tool to correctly display the language set by the system, and the apk directly installed can also display the language set by the system correctly, but when I download from Google When play downloads my app (app bundle uploaded by google play), my app does not display the language set by the system, but the language corresponding to my country. All installation methods can be in the app after installation Switch language normally, how should I solve this problem。

my gradle config:

android {

    defaultConfig {
        ...
        multiDexEnabled true
        ...
        ndk {
            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
        resConfigs "en-rUS", "zh-rCN", "zh-rTW"
    }
    bundle{
        language{
            enableSplit false
        }
    }
}
Vishist Varugeese
  • 1,500
  • 1
  • 17
  • 30
Alrey
  • 11
  • 2

1 Answers1

1

This problem has been solved. The reason is that the allowBackup attribute is configured as true in the Application attribute in the AndroidMainfest file. Change it to false. In the case of true, google service will back up the app configuration file, but I don’t know exactly what files to back up and how the backup is done. In addition, based on the problems I encountered in the process of using multiple languages, some tips for switching between multiple languages in the app are given.

Tip 1: For androidx.appcompat.appcompat dependency, it is best to use version 1.0.2, other versions will cause the in-app switching of multiple languages on some phones

Tip 2: bundle{ language{ enableSplit false } } If you need to switch multiple languages in the app, it is recommended to change this attribute to false, only for bundle packages.

Tip 3: Remember to configure resConfigs "ms-rMY", "zh-rCN", "zh-rTW" Otherwise, multi-language resources may not be packaged in the apk when packaging

Finally, my build.gradle configuration file

android{
  defaultConfig{
    bundle{
        language{
            enableSplit false
        }
    }
    resConfigs "ms-rMY", "zh-rCN", "zh-rTW"
  }
}
dependencies{
  implementation group: 'androidx.appcompat', name: 'appcompat', version: "1.0.2"
}
Alrey
  • 11
  • 2