Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Crash: Reviewing/Advanced Settings in Nougat

Open Ruckamongus opened this issue 10 years ago • 20 comments

Research

Enter an [ x ] character to confirm the points below:

[x] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid

[x] I have checked the manual and the FAQ and could not find a solution to my issue

[x] I have searched for similar existing issues here and on the user forum

Reproduction Steps
  1. Open app
  2. Click hamburger -> settings
  3. Click Reviewing or Advanced
Expected Result

Opens the Appearance/Advanced settings.

The AnkiDroid, Appearance, and Gestures menus work correctly and do not crash the application when opening them.

Actual Result

App crashes.

Debug info

I cannot supply debug info as I can't access the Advanced settings menu. I am using AnkiDroid version 2.6.2alpha1 on Pixel C with official Android 7.0 release build NRD90M.

Ruckamongus avatar Sep 07 '16 08:09 Ruckamongus

I can't reproduce this so it must be something specific to your collection or device. I see a lot of crashes on our crash reporting tool from Pixel C devices but I'm struggling to make any sense of them.

If you try renaming your AnkiDroid directory to something else so it starts a fresh profile, does it still crash?

hssm avatar Oct 06 '16 22:10 hssm

I just cleared the app's data and cache. I also renamed the AnkiDroid directory. I opened the app to all default settings and no decks. Went to settings and the same behavior persists. For what it's worth I updated to NRD91D today (latest security release from Google that came out today). I was hoping this update may have fixed some weird internal thing specific to Nougat, but unfortunately that was not the case. I'm not terribly adept at Android debugging; would a logcat help at all? What's the best way to generate one specific to the app?

Ruckamongus avatar Oct 06 '16 23:10 Ruckamongus

That's weird. I don't have a Nougat device so I can only test it on an emulator and it all works fine on that.

I think the easiest way is to generate some crash reports and I can try to find them on our end. Are you still on 2.6.2alpha1 or did you update to the beta?

hssm avatar Oct 06 '16 23:10 hssm

I'll generate two reports (one for each item menu that crashes). Is there anything in particular you want me to include in the messages?

I'm currently using 2.7beta1

Ruckamongus avatar Oct 06 '16 23:10 Ruckamongus

Put in the issue ID 4422.

hssm avatar Oct 06 '16 23:10 hssm

I think I sent a few (more than I meant too, sorry about that).

Ruckamongus avatar Oct 07 '16 00:10 Ruckamongus

Thanks.

Reviewing

java.lang.NullPointerException: Attempt to invoke virtual method 'int com.ichi2.ui.SeekBarPreference.getValue()' on a null object reference
at com.ichi2.anki.Preferences.updatePreference(Preferences.java:516)
at com.ichi2.anki.Preferences.access$300(Preferences.java:90)
at com.ichi2.anki.Preferences$SettingsFragment.onSharedPreferenceChanged(Preferences.java:812)
at android.app.SharedPreferencesImpl$EditorImpl.notifyListeners(SharedPreferencesImpl.java:479)
at android.app.SharedPreferencesImpl$EditorImpl.apply(SharedPreferencesImpl.java:387)
at android.preference.Preference.tryCommit(Preference.java:1415)
at android.preference.Preference.persistInt(Preference.java:1545)
at com.ichi2.ui.SeekBarPreference.setValue(SeekBarPreference.java:118)
at com.ichi2.anki.Preferences.initPreference(Preferences.java:428)
at com.ichi2.anki.Preferences.initAllPreferences(Preferences.java:387)
at com.ichi2.anki.Preferences.access$200(Preferences.java:90)
at com.ichi2.anki.Preferences$SettingsFragment.onCreate(Preferences.java:789)
at android.app.Fragment.performCreate(Fragment.java:2335)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:949)
at android.app.BackStackRecord.setLastIn(BackStackRecord.java:857)
at android.app.BackStackRecord.calculateFragments(BackStackRecord.java:897)
at android.app.BackStackRecord.run(BackStackRecord.java:727)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1578)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:483)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Other one

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.preference.CheckBoxPreference.isChecked()' on a null object reference
at com.ichi2.anki.Preferences.updatePreference(Preferences.java:470)
at com.ichi2.anki.Preferences.access$300(Preferences.java:90)
at com.ichi2.anki.Preferences$SettingsFragment.onSharedPreferenceChanged(Preferences.java:812)
at android.app.SharedPreferencesImpl$EditorImpl.notifyListeners(SharedPreferencesImpl.java:479)
at android.app.SharedPreferencesImpl$EditorImpl.apply(SharedPreferencesImpl.java:387)
at android.preference.PreferenceManager.setNoCommit(PreferenceManager.java:659)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:284)
at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:326)
at com.ichi2.anki.Preferences.initSubscreen(Preferences.java:308)
at com.ichi2.anki.Preferences.access$100(Preferences.java:90)
at com.ichi2.anki.Preferences$SettingsFragment.onCreate(Preferences.java:788)
at android.app.Fragment.performCreate(Fragment.java:2335)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:949)
at android.app.BackStackRecord.setLastIn(BackStackRecord.java:857)
at android.app.BackStackRecord.calculateFragments(BackStackRecord.java:897)
at android.app.BackStackRecord.run(BackStackRecord.java:727)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1578)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:483)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

hssm avatar Oct 07 '16 00:10 hssm

Awesome, I appreciate you looking into this. I'm a C++ guy almost exclusively so the best I can do for you is tell you good look with the NPE. :)

Ruckamongus avatar Oct 07 '16 00:10 Ruckamongus

I'm afraid without a reproducible test case there isn't much I can do. I can't understand how it can end up in that state and a lot of the preferences stuff is relegated to Android libraries that handle most of that work.

hssm avatar Oct 07 '16 01:10 hssm

That's disappointing. Nonetheless I appreciate you looking into this. I don't have any other device running Nougat yet so I can't test outside of my Pixel C. It's kind of a Frankenstein device anyway though (chrome OS kernel under Android) so who knows what hackery is going on in the underlying libs. I'll keep playing around and if I find something worth mentioning I'll let you know. Thanks again for looking into this!

Ruckamongus avatar Oct 07 '16 17:10 Ruckamongus

This bug affects me on Nexus 9 running Android 7.0 and 7.1, which as far as I know is a "clean" build of Android without any parts from ChromeOS.

dag avatar Dec 18 '16 07:12 dag

I have a custom rom, AICP, that runs Android 7.1.1 on a VS985 (LG G3, Verizon variant) and the app does not crash. :/

Ruckamongus avatar Dec 18 '16 07:12 Ruckamongus

I could reproduce the problem on Samsung Galaxy Tab S2 9.7 Wifi model. The exception was thrown from Preferences.updatePreference(), and the problem is

        Preference pref = screen.findPreference(key);

this call fails for some keys, so pref is set to null. Adding the null check solved the crash issue.

        Preference pref = screen.findPreference(key);
        if (pref == null) {
            return;
        }

I didn't investigate why screen.findPreference() returns null on some devices, however, it looks safe workaround to add this null check logic.

isseis avatar Sep 14 '17 22:09 isseis

Thanks! Could you please make a pull request?

On Fri, Sep 15, 2017 at 7:30 AM, isseis [email protected] wrote:

I could reproduce the problem on Samsung Galaxy Tab S2 9.7 Wifi model. The exception was thrown from Preferences.updatePreference(), and the problem is

    Preference pref = screen.findPreference(key);

this call fails for some keys, so pref is set to null. Adding the null check solved the crash issue.

    Preference pref = screen.findPreference(key);
    if (pref == null) {
        return;
    }

I didn't investigate why screen.findPreference() returns null on some devices, however, it looks safe workaround to add this null check logic.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ankidroid/Anki-Android/issues/4422#issuecomment-329626563, or mute the thread https://github.com/notifications/unsubscribe-auth/ACsA4h6cYgFIMk2xtXoh_JQrcW_B6aFuks5siajugaJpZM4J2sGD .

timrae avatar Sep 15 '17 00:09 timrae

Sent out the pull request: https://github.com/ankidroid/Anki-Android/pull/4706

isseis avatar Sep 15 '17 20:09 isseis

This issue post is really old, but I am experiencing the same issue on my Samsung Tab A 10.1 with spen. I cannot access the advanced or review settings menu

Cobular avatar Sep 25 '17 01:09 Cobular

Basically we can't do anything without a stack trace...

On 25/09/2017 10:33, "Royalcows9" [email protected] wrote:

This issue post is really old, but I am experiencing the same issue on my Samsung Tab A 10.1 with spen. I cannot access the advanced or review settings menu

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ankidroid/Anki-Android/issues/4422#issuecomment-331755902, or mute the thread https://github.com/notifications/unsubscribe-auth/ACsA4jMa8gs-iC3VTGtn1ZeCmCFEYTADks5slwLOgaJpZM4J2sGD .

timrae avatar Sep 25 '17 01:09 timrae

I also have this issue. Samsung tab a, submitted 5 reports through app. I am trying to move my collection files to sd card ans deaperately need access to asvanced settings menu

NoroiKisaragi avatar Sep 25 '17 02:09 NoroiKisaragi

Submitted report with issue id 4422

NoroiKisaragi avatar Sep 25 '17 02:09 NoroiKisaragi

I don't think the fix was released until 2.8.3 which was in Nov 2017, so all commentary on this is from prior to the release. I'm going to close this but if anyone has current information from v2.8.3+ please reopen with whatever details you have. Thanks!

mikehardy avatar Sep 14 '18 03:09 mikehardy