I have some problems with an App, which I wrote with kivy an packaged with buildozer is always crashing when I try to run in on my phone. On my PC I use Ubuntu 14.10 and I don't get any error when compiling it (buildozer android debug). Then I send it on my SmartPhone and I install and run it, but it just loads and after a few seconds it crashes. By the way the kivy program is not very big. Could someone help me, please? And sorry for my bad grammar ;)
3 Answers
Buildozer.spec, use the following setting
Tittle= abc
Package.name=abc
Package.domain=org.abc
Include all your files eg.png,txt etc
Requirements= python3,kivy==2.0.0,kivymd, pillow,kivy-deps.angle,kivy-deps.glew,kivy-deps.sdl2
Uncomment android.logcat. Now make sure your phone is on developer mode, connect your phone to the computer, turn on USB debugging, open a terminal,
cd abc
sudo apt install scrcpy
Type
sudo apt install adb
type
scrcpy
your phone will appear on your computer.
Type
buildozer android debug deploy run logcat.
adb logcat -s python
Run your app on your phone ( ensure you phone is connected to your computer); your log file will appear
Try using kivy-launcher just put your main.py and other files and run it and you can debug logs inside log directory. Then once you got all the error fix build an apk and use it.
If you are using kivy and your app loads some images, then there is no problem. But if you are using some other packages like pygame to load images, it will crash. Or if you are working in some files like reading or writing a text file, it will crash. Because when you package your app with buildozer, It will move the additional files of your app (.txt, .png) to a different location. So your python file fails to find the additional files in your specified location. To solve this, do some corrections in your python file like changing the path of the additional file from the current directory of the python file to the path that is referred below.
PATH = "/data/data/#package domain#.#package name#/files/app"
In the above path change #package domain# with the domain of your package and #package name# with your package name. All the additional files of any app that is installed in an android device will go to this location.
Try out this. All the best.
buildozer android logcat
to dump all log output from your device; copy and paste from the start of your application run until it crashes.