I have some localized files with strings in folders like
values
values-ru
values-es
etc.
In every folder there is a strings.xml file with same keys but different values.
And in debug mode it works perfectly. But when I download app from Play Market, it crashes with Resources$NotFoundException on every locale.
Also, I do
Locale locale = getBaseContext().getResources().getConfiguration().locale;
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
during initialization. May it be the reason?
Any suggestions?
Log from dev. console:
android.content.res.Resources$NotFoundException: String resource ID #0x7f080010
at android.content.res.Resources.getText(Resources.java:201)
at android.content.res.Resources.getString(Resources.java:254)
at android.content.Context.getString(Context.java:182)
at com.companyName.appName.menuActivity.onWindowFocusChanged(menuActivity.java:115)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:1986)
at android.view.View.dispatchWindowFocusChanged(View.java:3788)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:658)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1921)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
I removed this part
and it works. As I can suggest, there is no need to fix locale and system will use needed resources just as supposed.