sergchil/AOSP-Kayboard-7.1.2

android.content.res.Resources$NotFoundException: String resource ID #0x0

mgood7123 opened this issue · 2 comments

is it normal for

final Integer nameId = sKeyboardLayoutToNameIdsMap.get(key);

( final Integer nameId = sKeyboardLayoutToNameIdsMap.get("qwerty"); )
to return 0?

sKeyboardLayoutToNameIdsMap = {HashMap@11202}  size = 12
 "zz_azerty" -> {Integer@11296} 0
 "zz_colemak" -> {Integer@11296} 0
 "zz_qwertz" -> {Integer@11296} 0
 "zz_pcqwerty" -> {Integer@11296} 0
 "colemak" -> {Integer@11296} 0
 "azerty" -> {Integer@11296} 0
 "pcqwerty" -> {Integer@11296} 0
 "qwerty" -> {Integer@11296} 0
 "dvorak" -> {Integer@11296} 0
 "qwertz" -> {Integer@11296} 0
 "zz_qwerty" -> {Integer@11296} 0
 "zz_dvorak" -> {Integer@11296} 0

as i get a Resources.NotFoundException for return res.getString(0, "German");

E/UGAT.SMALLVILL: Invalid ID 0x00000000.
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: NOUGAT.SMALLVILLE, PID: 31824
    android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.content.res.Resources.getText(Resources.java:348)
        at android.content.res.Resources.getString(Resources.java:441)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils$1.job(SubtypeLocaleUtils.java:230)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils$1.job(SubtypeLocaleUtils.java:227)
        at com.android.inputmethod.latin.utils.RunInLocale.runInLocale(RunInLocale.java:40)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils.getSubtypeLocaleDisplayNameInternal(SubtypeLocaleUtils.java:233)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils.getSubtypeLocaleDisplayNameInSystemLocale(SubtypeLocaleUtils.java:187)
        at com.android.inputmethod.latin.settings.CustomInputStylePreference$SubtypeLocaleItem.<init>(CustomInputStylePreference.java:262)
        at com.android.inputmethod.latin.settings.CustomInputStylePreference$SubtypeLocaleAdapter.<init>(CustomInputStylePreference.java:298)
        at com.android.inputmethod.latin.settings.CustomInputStyleSettingsFragment.onActivityCreated(CustomInputStyleSettingsFragment.java:118)
        at android.app.Fragment.performActivityCreated(Fragment.java:2531)
        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1318)
        at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2426)
        at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2205)
        at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2161)
        at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2062)
        at android.app.FragmentManagerImpl$1.run(FragmentManager.java:738)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

also causes a crash when opening the keyboard itself

W/RichInputMethodSubtype: Can't find emoji subtype
W/RichInputMethodSubtype: No input method subtype found; returning dummy subtype: Multi-lingual subtype: android.view.inputmethod.InputMethodSubtype@d78b2ed0, zz
I/EmojiCategory: Last Emoji category id is 8
W/ViewPager: Requested offscreen page limit 0 too small; defaulting to 1
I/LatinIME: Starting input. Cursor position = 0,0
E/UGAT.SMALLVILL: Invalid ID 0x00000000.
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: NOUGAT.SMALLVILLE, PID: 3128
    android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.content.res.Resources.getText(Resources.java:348)
        at android.content.res.Resources.getString(Resources.java:441)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils$1.job(SubtypeLocaleUtils.java:230)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils$1.job(SubtypeLocaleUtils.java:227)
        at com.android.inputmethod.latin.utils.RunInLocale.runInLocale(RunInLocale.java:40)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils.getSubtypeLocaleDisplayNameInternal(SubtypeLocaleUtils.java:233)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils.getReplacementString(SubtypeLocaleUtils.java:266)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils.getSubtypeDisplayNameInternal(SubtypeLocaleUtils.java:287)
        at com.android.inputmethod.latin.utils.SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(SubtypeLocaleUtils.java:273)
        at com.android.inputmethod.accessibility.MainKeyboardAccessibilityDelegate.announceKeyboardLanguage(MainKeyboardAccessibilityDelegate.java:125)
        at com.android.inputmethod.accessibility.MainKeyboardAccessibilityDelegate.setKeyboard(MainKeyboardAccessibilityDelegate.java:94)
        at com.android.inputmethod.keyboard.MainKeyboardView.setKeyboard(MainKeyboardView.java:405)
        at com.android.inputmethod.keyboard.KeyboardSwitcher.setKeyboard(KeyboardSwitcher.java:154)
        at com.android.inputmethod.keyboard.KeyboardSwitcher.setAlphabetKeyboard(KeyboardSwitcher.java:213)
        at com.android.inputmethod.keyboard.internal.KeyboardState.setAlphabetKeyboard(KeyboardState.java:305)
        at com.android.inputmethod.keyboard.internal.KeyboardState.onLoadKeyboard(KeyboardState.java:143)
        at com.android.inputmethod.keyboard.KeyboardSwitcher.loadKeyboard(KeyboardSwitcher.java:125)
        at com.android.inputmethod.latin.LatinIME.onStartInputViewInternal(LatinIME.java:957)
        at com.android.inputmethod.latin.LatinIME$UIHandler.onStartInputView(LatinIME.java:479)
        at com.android.inputmethod.latin.LatinIME.onStartInputView(LatinIME.java:779)
        at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1863)
        at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1814)
        at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:575)
        at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:207)
        at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'

ok, i seemed to have fixed it by doing

    private static final String RESOURCE_PACKAGE_NAME = R.class.getPackage().getName();

in SubtypeLocaleUtils AOSP-Kayboard-7.1.2\app\src\main\com\android\inputmethod\latin\utils\SubtypeLocaleUtils.java