[英]Change language of app works in android studio, doesnt works when downloaded app from Google Play
I need to change the app of my app.我需要更改我的应用程序的应用程序。 Im using this code:我使用这段代码:
private void saveLang() {
if(prefs==null){
prefs=getSharedPreferences("prefs", MODE_PRIVATE);
}
SharedPreferences.Editor editor=prefs.edit();
editor.putString("lang", lang);
editor.apply();
LocaleHelper.setLocale(ListActivity.this, lang);
}
And then, in every activity, I use this code:然后,在每个活动中,我都使用以下代码:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
With this, the language change WORKS when I instale it from Android Studio...but DOESNT when I upload the.abb file and download the app from Google Play.有了这个,当我从 Android Studio 安装它时,语言更改可以工作......但是当我上传 .abb 文件并从 Google Play 下载应用程序时不会。 Anybody knows why?有人知道为什么吗?
When generating build as android app bundle, the language files are also spliced and that's why you maybe facing this issue.当生成构建为 android 应用程序包时,语言文件也会被拼接,这就是您可能遇到此问题的原因。 Try adding the following block to the app level gradle file inside the android{} block.尝试将以下块添加到android{}块内的应用级 gradle文件中。 Push a build to alpha or internal testing track to check if its working properly.将构建推送到 alpha 或内部测试轨道以检查其是否正常工作。
bundle {
language {
enableSplit = false
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.