Search code examples
python-3.xkivypackagingkivymdbuildozer

Kivymd package crashes every time


I am working with both kivy and kivymd. Now I am trying make an apk file that can be installed on Android. And I made it using Buildozer.

After installing, when I open the application it just show the splash screen and then crashesh..

I can not find out the problem. Please help me.

Searching on internet I have tried many combination of "requirement". I don't think the problem is in requirement. Morever, I have checked the code. It is nothing but a dummy, just to check if I can use buildozer or not.


Solution

  • I had the same problem. After days of trying different things, here's what I think the problem is: https://github.com/kivymd/KivyMD/blob/master/README.md#how-to-fix-a-shader-bug-on-an-android-device

    Seems the latest versions of kivy and kivymd have a bug on Android (?) that can be solved by using the latest development versions of kivy and kivymd.

    So with your virtual environment activated, do:

    pip3 uninstall kivy
    pip3 uninstall kivymd
    

    then:

    pip3 install https://github.com/kivy/kivy/archive/master.zip
    pip3 install https://github.com/kivymd/KivyMD/archive/master.zip
    

    and replace your kivy and kivymd requirements in buildozer.spec with:

    requirements = kivy==master, https://github.com/kivymd/KivyMD/archive/master.zip
    

    To add to the fun, I can't get the latest development versions of kivy and kivymd to run on Ubuntu. But they compiled to an APK successfully and on my phone the app doesn't crash.

    To go back to developing on your computer, you'll have to uninstall kivy and kivymd (as above) and reinstall:

    pip3 install kivy
    pip3 install kivymd