Advice for reading logcat to diagnose crashing Kivy app

1,337 views
Skip to first unread message

Thomas Edwards

unread,
Feb 1, 2021, 5:37:52 AM2/1/21
to Kivy users support
I'm attempting to compile and run the kitchen_sink demo from KivyMD on my phone. It works when running kivy locally on my computer but not on my phone. I run the command `buildozer android debug deploy run` and then I open another terminal and run `adb logcat`. On my phone the app shows the KivyMD splashscreen and then immediately crashes.  

In the log I'm not sure what I'm looking for, it's quite a large log file and I can't find any obvious error message associated with the crash. Could someone give me some advice, i.e what to grep for or something? Thanks 


planckp...@gmail.com

unread,
Feb 2, 2021, 7:24:32 PM2/2/21
to Kivy users support
Search in the logcat for "Traceback".
The following lines are a Python stack trace. The last line of which is usually the most important.

It is sometimes better to start with "Hello World" as it builds with the default buildozer.spec

Thomas Edwards

unread,
Feb 3, 2021, 3:04:22 AM2/3/21
to Kivy users support
Thanks, I found the error message:

02-01 11:46:57.975 1391 3165 I python : Traceback (most recent call last):
02-01 11:46:57.975 1391 3165 I python : File "/home/tedwards/code/KivyMD/demos/kitchen_sink/.buildozer/android/app
/main.py", line 9, in <module>
02-01 11:46:57.975 1391 3165 I python : File "/home/tedwards/code/KivyMD/demos/kitchen_sink/.buildozer/android/pla
tform/build-armeabi-v7a/build/python-installs/kitchen_sink/kivymd/__init__.py", line 40, in <module>
02-01 11:46:57.976 1391 3165 I python : File "/home/tedwards/code/KivyMD/demos/kitchen_sink/.buildozer/android/pla
tform/build-armeabi-v7a/build/python-installs/kitchen_sink/kivy/__init__.py", line 138, in require
02-01 11:46:57.976 1391 3165 I python : Exception: The version of Kivy installed on this system is too old. (You hav
e 1.11.1, but the application requires 2.0.0)
02-01 11:46:57.976 1391 3165 I python : Python for android ended.

This is rather odd because I have kivy 2.0.0 installed, yet it thinks I have 1.11.1. This is what it says when I do `python -c "import kivy; print(kivy.__version__)"`:

[INFO ] [Logger ] Record log in /home/tedwards/.kivy/logs/kivy_21-02-03_1.txt
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "/home/tedwards/anaconda/envs/kivy/lib/python3.9/site-packages/kivy/__init__.py"
[INFO ] [Python ] v3.9.1 | packaged by conda-forge | (default, Jan 10 2021, 02:55:42)
[GCC 9.3.0]
[INFO ] [Python ] Interpreter at "/home/tedwards/anaconda/envs/kivy/bin/python"
2.0.0

Thomas Edwards

unread,
Feb 3, 2021, 3:50:02 AM2/3/21
to Kivy users support
I noticed that in the buildozer.spec file I had kivy==1.11.1 as one of the requirements, but I then changed this to kivy=2.0.0. However, I still get the same error message when I recompile and run the APK. 

Thomas Edwards

unread,
Feb 3, 2021, 3:52:55 AM2/3/21
to Kivy users support
It won't let me attach files here so here's a copy-paste of the buildozer.spec file:

[app]

# (str) Title of your application
title = KivyMD Kitchen Sink

# (str) Package name
package.name = kitchen_sink

# (str) Package domain (needed for android/ios packaging)
package.domain = com.heattheatr

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,jpeg,ttf,md,kv,json

# (list) List of inclusions using pattern matching
source.include_patterns = assets/*

# (str) Application versioning (method 2)
version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/../../kivymd/__init__.py

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
#requirements = python3,kivy==1.11.1,git+https://github.com/HeaTTheatR/KivyMD.git,pillow,pygments
requirements = python3,kivy==2.0.0,git+https://github.com/HeaTTheatR/KivyMD.git,pillow,pygments

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
requirements.source.kivymd = ../../kivymd

# (str) Presplash of the application
presplash.filename = %(source.dir)s/assets/presplash.png

# (str) Icon of the application
icon.filename = %(source.dir)s/assets/kivy-logo-white-512.png

# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)
orientation = portrait

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0

# (string) Presplash background color (for new android toolchain)
android.presplash_color = #FFFFFF

# (list) Permissions
android.permissions = INTERNET,WRITE_EXTERNAL_STORAGE

# (int) Target Android API, should be as high as possible.
android.api = 28

# (int) Minimum API your APK will support.
android.minapi = 21

# (str) Android NDK version to use
android.ndk = 19b

# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
android.skip_update = False

# (bool) If True, then automatically accept SDK license
# agreements. This is intended for automation only. If set to False,
# the default, you will be shown the license when first running
# buildozer.
android.accept_sdk_license = True

# (str) Android logcat filters to use
# android.logcat_filters = *:S python:D

# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.arch = armeabi-v7a


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 0

# (str) Path to build artifact storage, absolute or relative to spec file
build_dir = ./.buildozer

# (str) Path to build output (i.e. .apk, .ipa) storage
bin_dir = ./bin

Andreas Ecker

unread,
Feb 3, 2021, 8:07:28 AM2/3/21
to kivy-...@googlegroups.com
To build the APK, buildozer downloads and compiles CPython and the libraries specified in the requirements setting of buildozer.spec independent from the versions installed on your build system/computer.

Maybe give the requirements setting I currently use a try:
requirements = android, hostpython3==3.7.5, python3==3.7.5, kivy==2.0.0, plyer

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/140e147c-836a-4d33-8f5e-b8a2667b0ae5n%40googlegroups.com.

Andreas Ecker

unread,
Feb 3, 2021, 8:11:10 AM2/3/21
to kivy-...@googlegroups.com
... and remember to run `buildozer android clean` before run the compilation via `buildozer android debug`, after changing anything the requirements setting.
Reply all
Reply to author
Forward
0 new messages