Android 特定语言的 Resources$NotFoundException

Android Resources$NotFoundException on a specific language

所以基本上,我有一个应用程序有数千次下载,一些用户(大约 200 人)看到他们的应用程序在 activity 时崩溃,但出现此异常 android.content.res.Resources$NotFoundException: at android.content.res.Resources.getStringArray (Resources.java:1391)

所以这是代码崩溃的地方(在第二行):

int arrayId = getResources().getIdentifier(ct, "array", view.getContext().getPackageName());
String[] ctOp = getResources().getStringArray(arrayId);

我检索的数组有这个 tools:ignore="MissingTranslation",它只在值文件夹中(例如,值-XX 中没有任何内容)。

另一件事是,所有就这次坠机事件与我联系的人都来自土耳其。

我发现了问题,我正在这样做:

ct = ct.toLowerCase();

显然在土耳其语中,如果您这样做会出现错误,因此您需要那样做:

ct = ct.toLowerCase(Locale.ENGLISH);

toUpperCase

相同

For more information about this bug, click here