Language change is working before uploading to Google Play Store but not after uploading to play store . Why?
Asked Answered
A

3

39
  • In My Application There are two language.
  • If I download application from device which has English as default language.Then it is not changing to Chinese strings.xml (zh) .
  • If I change my device language to Chinese and download the application then it is working fine and changing to both languages.Maybe because we have English language in our default strings.xml file.

Maybe because google play store doesn't let user download resource file which it thinks user will not need.

Can anyone help me? Thanks.

Antenna answered 23/2, 2019 at 9:31 Comment(0)
S
77

The problem is that you're using .aab file to publish app on play store . Which removes localization files based on the user's phone settings when it's been installing .

To solve that you need to put this lines in your build.gradle file and try uploading again

android {

  //... removed for brevity
  bundle {

     language {
       enableSplit = false
     }
   }
}

Link to refer

Shirline answered 25/2, 2019 at 8:34 Comment(6)
Thumbs up!! one quick question, what about .aab size then?Helio
It won't effect much DW.Shirline
I thought that the problem was due to the fact that we are obfuscating our application, thanks to you I can finally correct the problem.Privilege
Glad to be helpful :)Shirline
not working for me, can you explain why language files are removed after upload?Procyon
Google introduced a new App Bundle format to split apk files in smaller sizes when they’re being installed on the client devices. We need to explicitly give command to not split language files.@MoustafaEL-SaghierShirline
A
14

As @Vrushi Patel said, this is related to Android App Bundles. To fix this you have to edit the android.bundle block in your base module’s build.gradle as shown below as mentioned in the official documentation:

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
        // dynamic 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
    }
}
}
Abbeyabbi answered 6/5, 2019 at 11:19 Comment(0)
A
0

.aab file , remove the localization files . To resolve this issue , add these lines in build.gradle file and upload .aab file at play store again.

android {
    bundle {
        language {
            enableSplit = false
        }
    }
}
Allembracing answered 2/11, 2022 at 8:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.