SOLVED PROBLEM :
I would like to ask about a Kivy-Python app just built using
buildozer
on the Oracle virtual machine. The app is written in Windows, python 3 usingkivy
and depends onnumpy
, and some.png
file.Building the apk file :
On the virtual machine Linux terminal, I have set the project folder that contains the main file
main.py
, and then run:buildozer android debug
the process by this line took quite some time. The apk file has size of 11MB. After I plug in the phone, I ran (on VM Linux terminal):
buildozer android deploy run
The app was installed on the phone.
The problem :
But when I open it : it only says "loading..." alongside with the Kivy logo and then it closes itself. What causes this?
The python that I saw in the VM terminal is
python 2.7.13
while my code was written inpython 3
. Is this the problem? If it is, what is the solution?Hope to get feedbacks on this. Thanks.
SOLUTION :
The solution was to rewrite the code such that it works in
python 2.7
. Now the code works in Python2 and Python3. Then I build the apk using this editedmain.py
. Now, it does not crash.
You can add a regex to filter some logcat's outputs by uncommenting the "android.logcat_filters = *:S python:D" line in the buildozer.specs, (it's just look at log concerning python, but you can add some info to filter more.).
Also I went through similars problems with this configuration (python3 on computer, and python2 on android, and yes, you have to make your code "almost" both compatible).
For that, there are some easy steps to remember (I might forget some):
Add "@static-method" the line before statics methods are defined
Add an empty "__init__.py" file on python subfolders
I doubt it's a problem with numpy recipe, but it can, so you can add the version you want to use in buildozer.specs, or just clean the buildozer to test again.
Hope this help you, let me know :)