App built with kivy/buildozer does not work on android device

831 views
Skip to first unread message

Mihai Bacauanu

unread,
Sep 4, 2023, 6:20:35 AM9/4/23
to Kivy users support
Hello,

I managed to create an apk with buildozer and kivy.
I have installed the apk on my android device but when I opened it, it says loading and after it closes. 

I have tried to debug via USB, usb debugging is activated on the phone, adb version from winows and WSL are the same and in logcat it seem that the app enters in a loop:
"# Waiting for application to start."

Android device have android 12, API 31

Could you kindly help me on this matter?

Thank you
buildozer.spec
main.py
my_log.txt

Mihai Bacauanu

unread,
Sep 4, 2023, 12:13:15 PM9/4/23
to Kivy users support
I managed to debug my app and got a full logcat.

I have attached the log cat .
log.txt

Mihai Bacauanu

unread,
Sep 4, 2023, 4:48:50 PM9/4/23
to Kivy users support
found in the log:
"09-04 19:09:08.349 27017 27017 V pythonutil: Loading library: python3.6m
09-04 19:09:08.349 27017 27017 V pythonutil: Library loading error: dlopen failed: library "libpython3.5m.so" not found
09-04 19:09:08.349 27017 27017 V pythonutil: Loading library: python3.6m
09-04 19:09:08.351 27017 27017 V pythonutil: Library loading error: dlopen failed: library "libpython3.6m.so" not found
09-04 19:09:08.351 27017 27017 V pythonutil: Loading library: python3.7m
09-04 19:09:08.353 27017 27017 V pythonutil: Library loading error: dlopen failed: library "libpython3.7m.so" not found
09-04 19:09:08.353 27017 27017 V pythonutil: Loading library: python3.8
09-04 19:09:08.355 27017 27017 V pythonutil: Library loading error: dlopen failed: library "libpython3.8.so" not found
09-04 19:09:08.355 27017 27017 V pythonutil: Loading library: python3.9
09-04 19:09:08.356 27017 27017 V pythonutil: Library loading error: dlopen failed: library "libpython3.9.so" not found"

update the buildozer.spec requirements from:
requirements = python3,kivy==2.2.1,gspread,oauth2client

to:
requirements = python3.11,kivy==2.2.1,gspread,oauth2client

as Ive built the project in python 3.11

Let's see if this is the issue, any other help woul be appreciated if I am on the wrong path.

Robert

unread,
Sep 4, 2023, 8:04:12 PM9/4/23
to Kivy users support
This is the issue

09-04 19:09:09.926 27017 27058 I python  :  Traceback (most recent call last):
09-04 19:09:09.926 27070 27070 W android.vendin: JIT profile information will not be recorded: profile file does not exist.
09-04 19:09:09.926 27017 27058 I python  :    File "/home/devapp/teddy/.buildozer/android/app/main.py", line 8, in <module>
09-04 19:09:09.926 27070 27070 W android.vendin: JIT profile information will not be recorded: profile file does not exist.
09-04 19:09:09.926 27070 27070 W android.vendin: JIT profile information will not be recorded: profile file does not exist.
09-04 19:09:09.926 27017 27058 I python  :    File "/home/devapp/teddy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/teddy/arm64-v8a/gspread/__init__.py", line 7, in <module>
09-04 19:09:09.926 27017 27058 I python  :    File "/home/devapp/teddy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/teddy/arm64-v8a/gspread/auth.py", line 14, in <module>
09-04 19:09:09.927 27017 27058 I python  :  ModuleNotFoundError: No module named 'google'
09-04 19:09:09.927 27017 27058 I python  : Python for android ended.

The error is describe in general here:

https://github.com/Android-for-Python/Android-for-Python-Users#get-an-error-message

More specifically, specify  

https://github.com/Android-for-Python/Android-for-Python-Users#requirements

Also be aware of

https://github.com/Android-for-Python/Android-for-Python-Users#wheels

I think perhaps oauth2 will be a challenge, mainly because I don't know of any examples.
I have never tried it so I can't give specific help.

Peter Pacsay

unread,
Sep 5, 2023, 10:00:13 AM9/5/23
to Kivy users support
Hi,

I am not working in topic you did in your main.py, but i am working with the buildozer in colab and two things i could mention. 

I always use !buildozer -v android debug, if you use "!buildozer -v android debug logcat run" or
something like that can causes your problem in your my_log.text file.
I guess your app uses internet when it is running. If it is true than you have to use in buildozer.spec file
android.permissions = INTERNET, ACCESS_NETWORK_STATE and might have to use:

android.api = 33
android.minapi = 24 #?!
android.sdk = 33
android.ndk = 25b

Have a good solution soon,

Peter

Mihai Bacauanu

unread,
Sep 7, 2023, 2:47:10 PM9/7/23
to Kivy users support
It seems this issue will take me longer to solve.
I have started from zero again, on a new laptop.
Tried every solution provided on internet for the google module not found.

Atleast, I have only this google issue left on the traceback :))))
log.txt

Mihai Bacauanu

unread,
Sep 7, 2023, 3:55:53 PM9/7/23
to Kivy users support
used pipdetree to find all the dependencies of gspread and oauth2client, mentioned all of them in buildozer.spec and FINALLY after 4 days, solved the google module not found.

But now new issue hahah:
09-07 22:52:15.962 26980 27133 I python  : Android kivy bootstrap done. __name__ is __main__
09-07 22:52:15.962 26980 27133 I python  : AND: Ran string
09-07 22:52:15.962 26980 27133 I python  : Run user program, change dir and execute entrypoint
09-07 22:52:15.963 26980 27133 I python  : Traceback (most recent call last):
09-07 22:52:15.963 26980 27133 I python  :   File "/home/devapp/teddy/.buildozer/android/app/main.py", line 2, in <module>
09-07 22:52:15.963 26980 27133 I python  : ModuleNotFoundError: No module named 'kivy'
09-07 22:52:15.963 26980 27133 I python  : Python for android ended.

I will be back:))

Mihai Bacauanu

unread,
Sep 7, 2023, 5:01:22 PM9/7/23
to Kivy users support
the kivy not found module occured because i forgot to add kivy in buildozer.spec.

THE APP IS WORKING ON PHONE NOW!  <3

What I ve learned doing this project.

1. Follow the official instructions when building with Kivy/Buildozer
https://github.com/kivy/buildozer/blob/master/docs/source/installation.rst

2. Use WSL 2 if you re planing to use windows subsystem

3. Add to buildozer.spec requirements = the modules used in your python project, also all its dependencies. (use 'pipdeptree -p kivy' to find the dependencies)
For example, in my project I use gspread, kivy, oauth2client and my buildozer.spec requirements look like this:
requirements = python3,gspread==5.11.0,kivy==2.2.1,google-auth,cachetools,oauthlib,pyasn1-modules,pyasn1,rsa,six,urllib3,google-auth-oauthlib,cachetools,requests-oauthlib,requests,certifi,charset-normalizer,idna,docutils,Kivy-Garden,Pygments,httplib2,pyparsing,oauth2client==4.1.3

*some dependencies repeat for each module, add just once
3.Debug, install, enjoy

Tips: search in other conversations related to your issue, you will for sure find something that will help you

P.S. Thank you, Robert

Robert

unread,
Sep 7, 2023, 6:44:08 PM9/7/23
to Kivy users support
And thanks for sharing what you found. Others will appreciate...
Reply all
Reply to author
Forward
0 new messages