Errors when packaging with buildozer.

529 views
Skip to first unread message

coutinh...@gmail.com

unread,
May 3, 2021, 9:15:18 AM5/3/21
to Kivy users support
Guys, after everything was ready I went to package my app with buildozer.
Following the steps in the documentation:
Android on Ubuntu 20.04 (64bit)

I received this return from the terminal:


The attached image shows this above.

Then when executing the command buildozar -v android debug it returns this error below:

raise ValueError ('storage dir path cannot contain spaces, please'
ValueError: storage dir path cannot contain spaces, please specify a path with --storage-dir


what can be wrong?
Captura de tela de 2021-05-03 10-06-36.png

Elias Coutinho

unread,
May 3, 2021, 9:41:03 AM5/3/21
to kivy-...@googlegroups.com
The problem was the directory that had blanks.

--
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/f172ffd1-5f3b-4ca4-a71d-8d1041d91bf2n%40googlegroups.com.


--
Elias Coutinho.
Aprender sobre alguns assuntos é fundamental.
Aprender sobre Deus é indiscutivelmente o melhor conteúdo.

Elias Coutinho

unread,
May 3, 2021, 12:56:26 PM5/3/21
to kivy-...@googlegroups.com
After correcting the error above I managed to generate the apk.
I installed on android and when running it broke, it didn't work.
Then through some internet tutorials I saw this command:

adb logcat -s python << ======

This taceback returned:

adb server version (41) doesn't match this client (39); killing ...
ADB server didn't ACK
Full server startup log: /tmp/adb.1000.log
Server had pid: 271220
--- adb starting (pid 271220) ---
adb I 05-03 13:46:49 271220 271220 main.cpp: 57] Android Debug Bridge version 1.0.39
adb I 05-03 13:46:49 271220 271220 main.cpp: 57] Version 1: 8.1.0 + r23-5ubuntu2
adb I 05-03 13:46:49 271220 271220 main.cpp: 57] Installed as / usr / lib / android-sdk / platform-tools / adb
adb I 05-03 13:46:49 271220 271220 main.cpp: 57]
error: could not install * smartsocket * listener: Address already in use

* failed to start daemon
- waiting for device -
* daemon not running; starting now at tcp: 5037
* daemon started successfully
--------- beginning of main
--------- beginning of system

Already with the command: buildozer -v android logcat

He didn't return anything, at least that's what I think.
Below I show you the return:

# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Run 'dpkg --version'
# Cwd None
Programa de gerenciamento de pacotes Debian 'dpkg' versão 1.19.7 (amd64).
Isto é software livre; veja a GNU General Public License versão 2 ou
posterior para condições de cópia. Não existe NENHUMA garantia.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /home/elias/.local/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Run '/home/elias/.buildozer/android/platform/android-sdk/platform-tools/adb devices'
# Cwd None
adb server version (39) doesn't match this client (41); killing...
* daemon started successfully
List of devices attached
M95UACPBHFK4G unauthorized

# Run '/home/elias/.buildozer/android/platform/android-sdk/platform-tools/adb logcat *:S python:D'
# Cwd /home/elias/.buildozer/android/platform
- waiting for device -
--------- beginning of main
--------- beginning of system

Message has been deleted
Message has been deleted

Robert

unread,
May 3, 2021, 5:59:57 PM5/3/21
to Kivy users support
- waiting for device -
--------- beginning of main
--------- beginning of system

This is it, sort of. There should be a lot of extra lines.

In buildozer.spec comment the line    android.logcat_filters   (or just run adb by hand)
Check log_level = 2
And build again.

adb server version (39) doesn't match this client (41); killing...
This is odd, I don't know if it is significant.
Normally buildozer uses adb from ~/.buildozer  or we can also use the one from Android Studio.
But here an older version from /usr /lib/android-sdk/platform-tools/ is used in this case.

Elias Coutinho

unread,
May 3, 2021, 6:02:20 PM5/3/21
to kivy-...@googlegroups.com
I commented a filter line in the spec that I had uncommented and the logcat returned with these errors:

https://gist.github.com/CoutinhoElias/e39539995197cb6031cb7bca43e3bba2

Robert

unread,
May 3, 2021, 8:24:49 PM5/3/21
to Kivy users support
That is what I was looking for, though not what I expected to see.
Three things
1) It doesn't get as far a starting Python
2) The usual Android logging is mostly absent
3) There are a lot of (presumably) Android messages I have never seen before.

From this I conclude the apk is corrupted in some way.
Something very basic is messed up, so back to basics.....

Forget your project for the moment, can you build and run Hello World ? 
Use the default buildozer.spec

Elias Coutinho

unread,
May 3, 2021, 9:02:47 PM5/3/21
to kivy-...@googlegroups.com
I was doing what you suggested and I found that the problem is Pyrebase in the requirements, however, I don't know how to add it to the requirements anymore.

Robert

unread,
May 3, 2021, 9:28:33 PM5/3/21
to Kivy users support
I have no experience with Pyrebase.

Its odd that a Python package would be the issue given Python is not starting.......hmmm.... The only way I can imagine that is if an x86 lib got in there but then I would expect to see a link error....

First test that Hello World does build and run.
Then use Hello World, add Pyrebase to the requirements and post the full build log.
Lets see if the Pyrebase dependencies build     https://github.com/thisbejim/Pyrebase/blob/master/requirements.txt

(requests will have missing requirements, but in this context that will not matter).

You probably got the message that I have no idea what is happening, I'm just suggesting the steps I would take if I were in your shoes.

Elias Coutinho

unread,
May 4, 2021, 7:36:09 AM5/4/21
to kivy-...@googlegroups.com
Good morning, I did a test with a Hello world! and it worked. Then I increased the project with kivymd and it didn't work on my android.

I am sending you my spec and application if you have time to try to pack around.

buildozer.spec
main.py

Robert

unread,
May 4, 2021, 3:30:51 PM5/4/21
to Kivy users support
For KivyMD in .spec you must use kivy==2.0.0

In general you can debug by looking at the logcat (the first issue aside).
In unfiltered logcat search for 'Traceback' what follows is a Python stack trace.
If filtered you will see the trace at the end of the logcat.

Some background reading, with links to the docs

I have a concern about interaction on your computer with previously installed Android tools.
It looks like this is the case for adb, so perhaps other tools?

I suggest you use Buildozer's adb directly (not from Buildozer which is using your legacy copy),
'find ~/.buildozer -name adb' will give you the path.

Elias Coutinho

unread,
May 5, 2021, 2:24:30 PM5/5/21
to kivy-...@googlegroups.com
Good afternoon,
I formatted my noteboo to do this packaging strictly right.

I installed Python, Kivy, KivyMD, Peewee and Pyrebase.
I ran the system on the computer and it worked but the terminal presented a strange message.

[WARNING] [MTD] Unable to open device "/ dev / input / event8". Please ensure you have the appropriate permissions.

I am using Ubunti 20.04, would this error not prevent the system from working on the cell phone?

Robert

unread,
May 5, 2021, 8:03:31 PM5/5/21
to Kivy users support
These local installs will be ignored by Buildozer, Kivy, KivyMD, Peewee and Pyrebase.  they are only used when when executing the app on Linux.
Buildozer installs its own copies in project/.buildozer  (assuming it knows that it should).

Does the message occurs when running the app on Linux?
Will it be significant on Android?
I could make up stories to support both cases, but I won't.

Elias Coutinho

unread,
May 6, 2021, 2:24:36 PM5/6/21
to kivy-...@googlegroups.com
I did a test here with a .py file
In it is the example TestNavigationDrawer.
I used a template provided by KivyMD and it worked perfectly.

I cloned this spec for my project, with a paw called images (with my images), several separate .py files (linked by imports), a .db file

I added pyrebase and peewee to the requirements and does not run the program on android.

I am suspecting that I need to point these folders and files separately just like I did in pyinstaller.

What do you think?

Here are my spec attachments and a print of my project folder:

buildozer.spec
Captura de tela de 2021-05-06 15-22-30.png

Robert

unread,
May 6, 2021, 4:59:18 PM5/6/21
to Kivy users support
>>  I am suspecting that I need to point these folders and files separately just like I did in pyinstaller.
In the build log you can see where these packages were downloaded. This the triggered by 'requirements' in .spec
(this only happens on the first build, to to see it you will probably have to do a buildozer appclean first).
(I notice pyrebase is commented in the posted .spec)

Now we need to see the logcat error.

One question does your code follow the Kivy lifecycle? And specifically is there any 'script style' functionality that talks to the OS (file access?) outside of a Python class?

Elias Coutinho

unread,
May 7, 2021, 4:26:14 PM5/7/21
to kivy-...@googlegroups.com
Look, I'm going to break the system apart and generate apk several times according to changes.

This will tell me where the error is.

I'll start with the screen codes only, then insert the others little by little.

You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/ldsMpygiwzU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/f4793f27-9db2-4f0d-bc81-23128fa9178bn%40googlegroups.com.

Elias Coutinho

unread,
May 11, 2021, 1:26:29 PM5/11/21
to kivy-...@googlegroups.com
Good afternoon,

I discovered one of the reasons I was giving an error when running the app on android.
Everything was working fine on android when I added db to the spec file and configured the application to create a database.

On the computer it works correctly, but after it is packaged and installed on android it breaks.

Am I trying to create a * .bd file in a prohibited place on android?
Or is it a problem in the spec? (I just added the db extension)

Robert

unread,
May 11, 2021, 5:37:18 PM5/11/21
to Kivy users support
No way for me to know where you are saving files ;)

As always the way to find the cause of an issue is to run the debugger and look in the logcat output.

Elias Coutinho

unread,
May 11, 2021, 5:38:50 PM5/11/21
to kivy-...@googlegroups.com
I'm saving to the same directory as the app.

Elias Coutinho

unread,
May 11, 2021, 7:03:53 PM5/11/21
to kivy-...@googlegroups.com
Guys, I swear I read the last text but it didn't solve it.
I would like for someone to package this code, and it works on your android.

Attachments main.py, main.kv together with the imagesy
MyLogCat.txt
buildozer.spec
menu.png
python.png
main.kv
main.py
models.py

Robert

unread,
May 11, 2021, 11:24:38 PM5/11/21
to Kivy users support
I looked at your logcat.
I see what is probably a very confused video codec, working on something it thinks might be a video but probably isn't.
Possibly related to Ucweb, and some ad site.

Looking at the timestamps the log was restarted several times, the phone seems busy doing codec stuff.

I do not see the Kivy app, the log is killed from the keyboard before the Kivy app starts (there is no logging from SDL or Python)

I suggest you try another phone or an emulator (and I never suggest that!) , or if you know what that codec app is then stop it for a while.

I understand you would like somebody to debug your app for you, if you asked me I would say I don't do that.

Elias Coutinho

unread,
May 11, 2021, 11:45:51 PM5/11/21
to kivy-...@googlegroups.com
I finally managed to make the kivymd app work with sqlite on android! \O/

Elias Coutinho

unread,
May 12, 2021, 7:30:07 AM5/12/21
to kivy-...@googlegroups.com
Good morning everybody,

My problem now is to use pyrebase in logcat, after I added pyrebase it stopped working on android.

Elias Coutinho

unread,
May 12, 2021, 9:53:00 AM5/12/21
to kivy-...@googlegroups.com
I have two theories:
1 - Or these imports are wrong:
a) from pyrebase import pyrebase
b) import pyrebase

I tested both and it only works on the computer.

2 - Or my requirement is incorrect regarding the yrebase:
requirements = python3, kivy == 2.0.0, https: //github.com/kivymd/KivyMD/archive/master.zip,pygments,sdl2_ttf==2.0.15,pillow, requests, certifi, urllib3, chardet, idna, plyer, peewee, pyrebase

Note: Without pyrebase and assigning the functions that I use pyrebase, the system works.

Elias Coutinho

unread,
May 12, 2021, 9:54:24 AM5/12/21
to kivy-...@googlegroups.com
I have two theories:
1 - Or these imports are wrong:
a) from pyrebase import pyrebase
b) import pyrebase

I tested both and it only works on the computer.

2 - Or my requirement is incorrect regarding the yrebase:
requirements = python3, kivy == 2.0.0, https: //github.com/kivymd/KivyMD/archive/master.zip,pygments,sdl2_ttf==2.0.15,pillow, requests, certifi, urllib3, chardet, idna, plyer, peewee, pyrebase

Note: Without pyrebase and commenting on the functions I use pyrebase the system works.

Robert

unread,
May 12, 2021, 12:23:29 PM5/12/21
to Kivy users support
Without an error message I cannot help you.

Based on the log shared, there is an interaction with another app.

Elias Coutinho

unread,
May 12, 2021, 3:27:11 PM5/12/21
to kivy-...@googlegroups.com
It does not generate an error log before generating the apk because there is no python error, what happens is that it generates the apk and it does not work on android.

When running the apk it shows no error.

using adb is the only way I've found to show logging and I still don't know if it's what you expect.

To generate this attached log I used the command:
adb logcat V log.tag.Inventario

If you need something specific you can send the command and I will return the result to you.

adb_log.txt

Robert

unread,
May 12, 2021, 7:53:23 PM5/12/21
to Kivy users support
Attached an example of a typical log of a normal, good, Kivy app start. Just search in the file for python.

On your phone none of this appears, the Kivy app is not shown starting. In addition there are a lot of messages from a video codec.

Best guess (This is I think what we see it your log files) :

There is some other app scanning the phone looking for video files.
It finds something it thinks is a video file when the Kivy apk is unpacked.
But the file is not a video file and the scanner throws a whole bunch of errors, but won't admit it is wrong and keeps trying.

This thrashing stalls the Kivy install process, which never completes.

It is an open question as to how this 3rd party app has permission to look in the Kivy app install directory.

That is what I think is happening, I could be wrong. This is the first issue, there may be others.
example_log.txt
Reply all
Reply to author
Forward
0 new messages