1

I have a rooted Lenovo P770, where I uninstalled several "system" apps, including the stock keyboard, TouchPal. After a factory reset I installed AnySoftKeyboard with adb (adb shell ime...), and now it works. However, I can no longer access Language & Input settings as I'm getting an "Unfortunately, Settings has stopped" message the moment I tap on the menu item. Here is the stacktrace from adb logcat:

W/dalvikvm( 8972): threadid=1: thread exiting with uncaught exception (group=0x40db2908)
E/AndroidRuntime( 8972): FATAL EXCEPTION: main
E/AndroidRuntime( 8972): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.SubSettings}: java.lang.NullPointerException
E/AndroidRuntime( 8972):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
E/AndroidRuntime( 8972):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
E/AndroidRuntime( 8972):        at android.app.ActivityThread.access$600(ActivityThread.java:149)
E/AndroidRuntime( 8972):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
E/AndroidRuntime( 8972):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 8972):        at android.os.Looper.loop(Looper.java:153)
E/AndroidRuntime( 8972):        at android.app.ActivityThread.main(ActivityThread.java:5108)
E/AndroidRuntime( 8972):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 8972):        at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 8972):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
E/AndroidRuntime( 8972):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)
E/AndroidRuntime( 8972):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 8972): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 8972):        at android.preference.PreferenceGroup.removePreferenceInt(PreferenceGroup.java:181)
E/AndroidRuntime( 8972):        at android.preference.PreferenceGroup.removePreference(PreferenceGroup.java:174)
E/AndroidRuntime( 8972):        at com.android.settings.VoiceInputOutputSettings.populateOrRemoveTtsPrefs(VoiceInputOutputSettings.java:144)
E/AndroidRuntime( 8972):        at com.android.settings.VoiceInputOutputSettings.populateOrRemovePreferences(VoiceInputOutputSettings.java:94)
E/AndroidRuntime( 8972):        at com.android.settings.VoiceInputOutputSettings.onCreate(VoiceInputOutputSettings.java:89)
E/AndroidRuntime( 8972):        at com.android.settings.inputmethod.InputMethodAndLanguageSettings.onCreate(InputMethodAndLanguageSettings.java:121)
E/AndroidRuntime( 8972):        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:796)
E/AndroidRuntime( 8972):        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
E/AndroidRuntime( 8972):        at android.app.BackStackRecord.run(BackStackRecord.java:635)
E/AndroidRuntime( 8972):        at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
E/AndroidRuntime( 8972):        at android.app.Activity.performStart(Activity.java:5030)
E/AndroidRuntime( 8972):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
E/AndroidRuntime( 8972):        ... 11 more
W/ActivityManager(  351):   Force finishing activity com.android.settings/.SubSettings
W/ActivityManager(  351):   Force finishing activity com.android.settings/.Settings

Since the stacktrace mentions VoiceInputOutputSettings, I tried installing the Google app (as far as I understand, it provides voice recognition capabilities), but that changed nothing. I have also tried installing TouchPal from the market, to no effect either.

Here are the entries from settings.db that seem relevant:

_id,name,value
72,selected_spell_checker,com.google.android.inputmethod.latin/com.android.inputmethod.latin.spellcheck.AndroidSpellCheckerService
73,selected_spell_checker_subtype,0
94,input_methods_subtype_history,com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME;834845621:com.menny.android.anysoftkeyboard/.SoftKeyboard;-1
95,selected_input_method_subtype,-1
96,default_input_method,com.menny.android.anysoftkeyboard/.SoftKeyboard
97,enabled_input_methods,com.menny.android.anysoftkeyboard/.SoftKeyboard

How can I fix this crash?

4
  • Reflashing the stock ROM would probably work. Then just refrain from uninstalling system apps that the system needs to work.
    – Dan Hulme
    May 17, 2016 at 12:34
  • @DanHulme I believe this problem can be solved without full reflashing. TouchPal is definitely not a kind of app that is required for Android to work. May 17, 2016 at 12:54
  • It might be. A part of the Language & Input Settings, the "Language" part, might be hosted by the installed and enabled keyboard app for some cases, and there might be other cross-links from there to the system default keyboard app. If you could grab an APK of TouchPal and push it to /system/app and possibly /system/priv-app, depending on where it had been installed previously, that might fix it, given a reboot and possibly another factory reset. From the next time onwards, know that you can safely get rid of the useless games and some Play apps, but leave the keyboard app alone. May 17, 2016 at 13:04
  • I grabbed the latest version of TouchPal from Play Store and "converted it to a system app" using Titanium. I suppose that's equal to moving the APK to /system/app. That changed nothing. May 17, 2016 at 13:14

1 Answer 1

0

Fixed by installing Google TTS.


This could be determined from the stacktrace and the settings app source code:

public void onCreate() {
    mParent = mFragment.getPreferenceScreen();
    mVoiceCategory = (PreferenceCategory) mParent.findPreference(KEY_VOICE_CATEGORY);
    mTtsSettingsPref = mVoiceCategory.findPreference(KEY_TTS_SETTINGS);

    populateOrRemovePreferences();
}

private void populateOrRemovePreferences() {
    boolean hasTtsPrefs = populateOrRemoveTtsPrefs();
    if (!hasTtsPrefs) {
        // There were no TTS settings and no recognizer settings,
        // so it should be safe to hide the preference category
        // entirely.
        mFragment.getPreferenceScreen().removePreference(mVoiceCategory);
    }
}

private boolean populateOrRemoveTtsPrefs() {
    if (mTtsEngines.getEngines().isEmpty()) {
        mVoiceCategory.removePreference(mTtsSettingsPref);
        return false;
    }

    return true;
}

The removePreference call was crashing. Apparently, I had also uninstalled Google TTS, which was bundled with this version of Android.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .