Unexpected crash on android phones Hypothesis

20 views
Skip to first unread message

Mateo Aita

unread,
Jun 19, 2020, 12:25:24 PM6/19/20
to Kivy users support
I've built an app using kivy that works fine when running the  code on pycharm,I tried it many times and for a long time and the app works fine, not a single unexpected crash. But after building the apk and testing it on phones (many times, I tried many changes  to fix the problem, which means I built many apks using buildozer) the app has unexpected crashes. I don't understand if there are some things I miss that may work prebuilding the apk that will definitely bring problems on phones. The main suspects to me are KivyMD widgets/functions regarding widgets like "reloading MDBottomnavigation to get it centred", changing images very fast on a certain screen that may kill the phone's capacity to proccess  information so it finishes the execution but my laptop can handle it so the problem is not there before testing it on phones. I don't know, I feel like I'm really stuck and I will never be able to fix it. I would really appreciate if someone has any piece of advice. Thank you very much!

Robert Flatt

unread,
Jun 19, 2020, 1:11:26 PM6/19/20
to Kivy users support
Did you post about this a few days ago? It looked like memory corruption?
Yes, these can be hard to find.
If the issue were the complexity of the UI task you would probably see a freeze (then perhaps a crash?).

Comment parts of the app until the behavior stops happening. Look at the removed code. Make a small test case.
The issue could be in the app, some other package, or the use of some other package.  :(


If you suspect KivyMD try a different version, and if you suspect a specific widget comment that first.
If you can demonstrate the a KivyMD issue, post it here https://github.com/HeaTTheatR/KivyMD/issues
Also try a different Kivy version (try it on the desktop first).

Presumably the Python code is writing to some a part of object that has been free'd by the garbage collector. (or somthing similar).
This corrupts whatever is using the memory now. In the previous posts that was graphics, but the actual corrupted item is probably irrelevant.
I expect the issue exists on the desktop, but you don't see it because the garbage collection is less frequent, so the object has not yet been free'd.
The garbage collection is differnt (I think) on Python 3.8, and also on Android the acutal collection seems to me more frequent. Reasonable becase Android has no virtual memory.

Mateo Aita

unread,
Jun 19, 2020, 2:23:33 PM6/19/20
to Kivy users support
Robert! I didn't understand the part about the garbage collector, I don't know what that term means. Thanks for the other tips!

Robert Flatt

unread,
Jun 19, 2020, 3:52:55 PM6/19/20
to Kivy users support

Mateo Aita

unread,
Jun 20, 2020, 10:19:39 AM6/20/20
to Kivy users support
Thank you, I could solve it or at least make it last longer without crashing, it is related to the reload() function that the MDBottomnavigation has, i recommend you don't use MDBottomnav and "simulate" it by using MDiconButtons inside a BoxLayout. Don't know why but it is working better.
Reply all
Reply to author
Forward
0 new messages