Skip to content

Fix MalformedJsonException crash on requestPermission action#105

Open
sprinter814 wants to merge 2 commits into
KamWithK:masterfrom
sprinter814:master
Open

Fix MalformedJsonException crash on requestPermission action#105
sprinter814 wants to merge 2 commits into
KamWithK:masterfrom
sprinter814:master

Conversation

@sprinter814

Copy link
Copy Markdown

I was hitting this exact crash on an Onyx Boox Go 6 (Android 11) — reportTopResumedActivityChanged followed by the app dying, triggered every time the Anki plugin tried to show a status pop-up (both with a direct AnkiDroid connection and with an AnkiConnect URL configured).

In my case it turned out the root cause was upstream: AnkiConnect Android (the AnkiConnectAndroid app, KamWithK/AnkiconnectAndroid) doesn't implement the requestPermission action that anki.koplugin's is_running() check sends, so it returns a malformed (non-JSON) response. The plugin choking on that response is what triggered the pop-up that then crashed KOReader on this device.

I tested on KOReader 2024.11 (where this was 100% reproducible) and then upgraded to the latest release, 2026.03 ("Snowflake"), keeping the same settings/profile. After fixing the AnkiConnect Android side (PR here: KamWithK/AnkiconnectAndroid — link to follow once merged/opened), the connection check succeeds and notes are added without any crash on 2026.03 on this same device.

I can't be 100% sure whether the underlying Adreno/SIGSEGV crash itself was separately fixed somewhere between 2024.11 and 2026.03, or whether avoiding the malformed-JSON error response was enough to avoid hitting the crashing code path at all in my case. But for anyone else on a Boox device hitting this: it's worth checking whether your AnkiConnect server is actually responding correctly to requestPermission first, since a broken response there reliably reproduces the crash for me on both KOReader versions.

Happy to provide more logs/device details if useful.

Added requestPermission method to handle permission requests for AnkiConnect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant