简体   繁体   English

更改应用程序的语言在 android 工作室中工作,从 Google Play 下载应用程序时不起作用

[英]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.

相关问题 从Google Play下载时,Android应用程序崩溃,但在本地开发人员中运行良好-为什么? - Android app crashes when downloaded from Google Play but works great in local dev - why? Map在调试Android应用程序时有效,但从Market下载时无效 - Map Works When Debugging Android App, But Not When Downloaded from Market 使用 Android Studio Android 应用程序在设备上运行 Google plus 但从 Play 商店下载时不起作用 - Using Android Studio Android app Working Google plus on device but when downloaded from play store Not Work 通过Android Studio运行时,Android应用程序中的语言发生了更改,但从Play商店下载应用程序后,这些更改不起作用 - Language changes in Android Application take place when running through Android Studio but do not work when app is downloaded from play store 从 Playstore 下载时,我的 Android 应用程序崩溃,但是当我将它从 Android Studio 运行到任何设备时,它可以正常工作 - My Android App is crashing when downloaded from the Playstore but when I run it from Android Studio into any device it works normally Android 登录屏幕在 Android Studio 调试 apk 上有效,但在从 Play 商店下载时无效 - Android login screen works on Android Studio debug apk but not when downloaded from Play Store 从 Google Play 下载时应用程序崩溃 - App crashes when downloaded from Google Play Android 应用程序在通过 Android Studio 安装时工作,但在通过 Google Play 安装和打开时显示一些设置页面 - An Android app works when installed via Android Studio but shows some settings page when installed and opened via Google Play Android 应用程序在 Android Studio 中运行良好,但在设备上无法运行 - Android App works fine in Android Studio but doesnt work on device Android 从 Play 商店下载的应用程序中的语言更改和设置完全被破坏 - Android language change and settings are completely broken inside app downloaded from Play Store
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM