App crashes after selecting Ankidroid for flashcards

Hi there,

I just got a new phone and set up Pleco on it. On my previous phone (also Android) I had set Pleco to use Ankidroid for the flashcards and it was working just fine.

After getting the new phone I changed the setting to use Ankidroid for flashcards, it changed but the deck selection and all other settings were blank. I closed everything and reopened both Pleco and Ankidroid.

I went back into Pleco and had to select Ankidroid again, but this time the app crashed, and crashed again every time after I opened it. I reset my phone and tried opening Pleco again but it just closed immediately.

After that I deleted Pleco and reinstalled, it worked fine but as soon as I chose Ankidroid for flashcards it crashes immediately and crashes less than a second after opening it again.

I just updated my android OS to the latest version and it still crashes.

Phone info (not sure how useful this is):

Phone: Xiaomi Redmi K30, MIUI 11.0.5
Android verison: 10
Android security patch: 2019-11-01


Staff member
Hmm... what version of AnkiDroid are you using? Is it working correctly on your phone other than this? And are you granting permission for Pleco to access your AnkiDroid database when prompted?
I'm using the latest Ankidroid. I can't find a version number but it's the latest on Google Play store (Oct 15, 2019)

Everything is working perfectly on the other phone.

I wasn't prompted for permissions, although I did go in and grant all permissions to Pleco in the system settings, but it still crashes.

I also updated Pleco today and it still crashes. I tried deleting and reinstalling again but it didn't help.


Staff member
Did that include the 'additional permission' for accessing AnkiDroid data? Or did the option for that not even show up?

We've had a few other reports of this so far but our initial assessment is that it's a bug in third-party permission prompts on MIUI 11; every user who's reported this issue so far has been using a Xiaomi phone with MIUI 11. (doesn't seem to matter if it's Android 9 or 10, it's something in the MIUI 11 skin specifically)

Could you try deleting Pleco and then installing the APK version downloaded directly from our website instead? (that will report crashes to us through our system instead of Google's and thus should hopefully give us more useful crash logs than what we're seeing so far)
I didn't see any pop ups asking for any permissions, the app just closes. (I can't remember if I did on the old phone either. Would you like me to reinstall Pleco there and check?)

I think my old phone did have the previous MIUI version, I still have it so I can try to update it and see if that breaks Pleco, if that's of any use to you?

Ok I've installed the APK from the site and let it crash a few times.


Staff member
No crashes coming through, which suggests this may be happening somewhere outside of our app's control.

So if you go into the system Settings app and look at Pleco's details page, is the AnkiDroid permission even listed there under 'additional permissions'?
It doesn't look like there is even a place for "additional permissions" or anything like that. I've attached screenshots of the Pleco app page and the permissions screen.

Some of the permissions are disabled in the picture but that's because I cleared all the app data to get Pleco to stop crashing (I guess it resets the setting). I've tried enabling everything on that page and then selecting Ankidroid but it still crashes.

As an aside, I just started up my old phone and the permissions page looks the same as this screenshot.

WeChat Image_20200103191143.pngWeChat Image_20200103191153.jpg


Staff member
Is there also a section that lists permissions and which apps have them? (i.e., that groups by permission instead of by app) Does anything related to AnkiDroid show up in there?

The fact that the screen is the same doesn't necessarily mean that the underlying implementation hasn't changed, i.e. it could be that a previous MIUI version wasn't enforcing that permission but the new one is. Or it could be something unrelated to permissions at all, it's just kind of odd that this particular issue is (as far as we can tell) only happening in one particular version of MIUI and that MIUI is doing something odd with AnkiDroid third party app permissions.
The only other permissions page I can find is this one:

WeChat Image_20200107225706.png

It doesn't seem like Pleco or Ankidroid are in any of those categories to turn on or off.

I'm not sure if this information is useful, but I've been playing around:

-After setting Ankidroid as the flashcard system, Pleco doesn't always crash immediately, I sometimes I have to change a card or try change a setting for it to crash.
-Once it's crashed, it will crash on start up every time.
-Today I went into ankidroid and disabled the API (advanced settings), when I went into Pleco it didn't crash immediately, instead it said that Ankidroid is missing and it can't find a copy on the phone. After that I could use Pleco normally.
-When I re-enabled the API in ankidroid and go back into Pleco it's fine until I do something related to flashcards, then it goes back to crashing.

One thing I can do without crashing Pleco is to say "open Ankidroid" in the menu. It goes to Ankidroid no problem and I can go back into Pleco without crashing until I try change a setting or create a card.
An update (once again, I'm not sure if this is useful):

I just had Pleco open with the Anki API disabled, in the main menu there is an option to "Open Ankidroid". I pressed it but instead of taking me to the Ankidroid app it took me the the "System Tracing" app (see screenshot)



Staff member
Interesting. We've now gotten a phone set up with MIUI 11 here but no luck reproducing the problem so far - seems like not only do you have to have MIUI 11 but there also has to be some as yet unspecified thing incorrect about or set up a certain way with your system.


Staff member
@Mark Havemann - someone suggested the following fix by email:

1) Turn on Developer Options if you haven't already - go into Settings / About Phone and tap on 'MIUI Version' a bunch of times until it says you're a developer.

2) Go into Additional Settings / Developer Options and turn off the "Turn on MIUI Optimization" option at the bottom.

3) Check Pleco's permission settings now - is there an option to give it permission to access AnkiDroid?
Amazing, that has made available the option for allowing permissions to Ankidroid. After doing what you suggested, everything works perfectly.

Some notes for anyone else who has the problem.

To enable developer mode on MIUI 11:
Settings -> my device -> all specs -> MIUI version (tap this 7 times)

After disabling MIUI Optimizations, the permissions to allow Pleco to access Ankidroid aren't in the settings menu (not anywhere I could find anyway), rather you need to long press the app icon until the little extra menu pops up, then choose "App Info", and extra options can be found there.

Turning off MIUI Optimizations seemed to make the UI a little sluggish, so I re-enabled it and everything still works fine with Pleco and Ankidroid.

Thanks for all your help Mike, and thanks to whoever made the suggestion to turn of MIUI Optimizations!