Kivy-Garden ZbarCam problem

342 views
Skip to first unread message

Guilherme Soares Lima

unread,
May 12, 2022, 4:14:39 PM5/12/22
to Kivy users support
Ok. Now I am a lit bit worried, as I spend some months on doing my app with kivy. Its now the third week I was seeking for a solution.
On the beggining, it was a great experience, and really fast developing, and a very expressive framework.
Then, I started the tests on Android real phones, and I couln't make it work. (tried many-many things)
I successfully tested other examples, on kivymd and I ran even on my android phone.
The project depends heavily on making zbarcam work on android (or other library to read barcodes on android and iphone) (while showing the barcode on the screen) .
Have anyone succeeded on generating an APK for the github repository example  on https://github.com/kivy-garden/zbarcam/  ???
If so, can you describe it step-by-step?
Version Hell Karma or not, I tried even downloading and installing ubuntu 20.04, as in the docs of buildozer.

Robert suggest trying to isolate, so far, what I tried:
1. removing the version pin on Pillow (Checked, no success)
2. JDK (Checked, installed version 13 installed on ubuntu 20.04 on Virtualbox)
3. Cython is the correct version
4. Another QR example (Checked, no success also, on Android APK generation)
5. Use 19c android ndk version (Checked, no success also)
6. Test master or develop branches on git zbarcam
7. Test master or develop branches on git p4a
8. Test buildozer 1.3.0 (working on other projects like KivyMD)
9. Use 23c android ndk version (it says it needs a p4a compatible with AAB generation, also with no solution)

Altought I am new to kivy, I red many docs and on other times people could download a fully configurated virtual machine, to avoid problems, Don ´t know why this wasn't offered anymore. Any clue for me?



Guilherme Soares Lima

unread,
May 12, 2022, 4:34:54 PM5/12/22
to Kivy users support
In adition,
10. Tried manual Android SDK/NDK (latest versions)

Guilherme Soares Lima

unread,
May 12, 2022, 5:47:18 PM5/12/22
to Kivy users support
I also tried to generate APK from

https://kivy.org/doc/stable/examples/gen__camera__main__py.html

Successfully. But very slow. But at least it worked. (also the camera orientation was not "right", but thats ok)

Anyone could help me with the zbarcam example?

Guilherme Soares Lima

unread,
May 12, 2022, 7:41:57 PM5/12/22
to Kivy users support
Tried to reset buildozer.spec file, it generates the APK as previously, but only shows splash screen with kivy logo, then, it closes the app. Any help appreciated.

Robert

unread,
May 12, 2022, 9:00:44 PM5/12/22
to Kivy users support
Run the debugger, the logcat log will contain any Python error message. A message from Python is the usual case.
If there is no Python error message, remove the text filter to see messages from Android (wait, haven't we been here before?)

If you don't understand the error message, post the FULL run time log as a .txt file here.

Guilherme Soares Lima

unread,
May 13, 2022, 3:01:22 PM5/13/22
to Kivy users support
Former, I was using my bare metal machine, so I could logcat on buildozer easily, setting up android debug.
Now that I ran on virtualbox, I had to read a couple of more docs just to understand there is no simple way of doing that.
Currently, my virtualbox system is strictly what is the recommended system in the docs.
I was able to generate APK files on other projects, and they ran fine on my android phone.
So perhaps it s not  exactly a kivy, p4a or buildozer direct problem. 
Don't know if it is related that the last activity of the zbarcam project (master branch) is from 2019.

I was digging futher the installation from the source, the makefile of the project.
It says on "SYSTEM_DEPENDENCIES="

build-essential \  ccache \ cmake \ curl \ git \ libsdl2-dev \ libsdl2-image-dev \ 
 libsdl2-mixer-dev \ libsdl2-ttf-dev \ libpython3.6-dev \  libpython$(PYTHON_VERSION)-dev \
 libzbar-dev \  pkg-config \  python3.6 \  python3.6-dev \    python$(PYTHON_VERSION) \  python$(PYTHON_VERSION)-dev \  tox \  virtualenv

I don't know, do you think this could be the problem, as these are regular deb apt files dependencies?

I don´t know how external libraries are handled by p4a. If a project does not have 100% python dependencies, could that be handled by p4a, or these have to be reimplemented?


Robert

unread,
May 13, 2022, 4:20:50 PM5/13/22
to Kivy users support
To debug on a desktop if the build was on a VM, use adb directly instead of via Buildozer.

Best to work from the log.

Anything used on Android must be (and is) built by p4a.

Robert

unread,
May 13, 2022, 4:24:09 PM5/13/22
to Kivy users support
Oops "(and is)" is not correct if the package is not pure Python and does not have a recipe  - this case does not apply to zbarcam.

Guilherme Soares Lima

unread,
May 13, 2022, 4:38:01 PM5/13/22
to Kivy users support
Ok. I'll try reading some of adb docs, but that's sure not as practical as "buildozer debug deploy run" option...

Guilherme Soares Lima

unread,
May 13, 2022, 4:39:10 PM5/13/22
to Kivy users support
Pardon me, I didn't understand, could you clarify what you meant?

Guilherme Soares Lima

unread,
May 13, 2022, 4:39:48 PM5/13/22
to Kivy users support
and off course "logcat".

Em sexta-feira, 13 de maio de 2022 às 17:24:09 UTC-3, Robert escreveu:

Robert

unread,
May 13, 2022, 5:15:37 PM5/13/22
to Kivy users support
Using adb is easy, all those noobs using Buildozer on Google Colab use it to debug, so it can't be hard.

My comment was a correction to my statement. The statement is true in this case, but may not be generally true - so the correction is off topic.

Guilherme Soares Lima

unread,
May 13, 2022, 5:33:27 PM5/13/22
to Kivy users support
Ok. Thank you anyway. I'm not exactly a "noob", altought I never managed to develop an app for mobile before.
I am more like a dinosaur, my first Linux system was slackware 3.0.
But you're probably right that's not difficult.
I'll try something else on my app.
I am acceptting suggestions on ways to make ean13 barcode reading while showing the barcode of the phone.
I will still not give up kivy, as I really liked it, so cool, specially with KivyMD.
But that's OK, if you can´t.
Thanks.

berk berk

unread,
May 13, 2022, 5:40:30 PM5/13/22
to Kivy users support
You need to scrcpy for use adb. https://github.com/Genymobile/scrcpy 

also onchange this on buildozer.
 # (str) Android logcat filters to use
android.logcat_filters = *:S python:D

type command to : buildozer android debug deploy run logcat

this is really easy look some videos. 
14 Mayıs 2022 Cumartesi tarihinde saat 00:15:37 UTC+3 itibarıyla Robert şunları yazdı:
Message has been deleted

Robert

unread,
May 14, 2022, 2:21:15 AM5/14/22
to Kivy users support
Funny, I think I'm telling you what you need to know to find your way past whatever the issue is.
And I see that it doesn't help you.

I get that you are not a noob, if anything it appears to me that you have too much experience !  (answer enough of these and you get to see the programmer styles !) It is always our assumptions that are the hardest issue to overcome.

I can only interpret data, I don't magically know what is happening there.
Data summaries do not help, something is filtered.
Debugging is mostly pretty easy if we follow the steps (and don't get distracted).

All I can do is go step by step, the next step is a full logcat output.

And heads up, there may be more than one issue so 'it doesn't work' doesn't tell be if we fixed an issue or not.

Guilherme Soares Lima

unread,
May 16, 2022, 6:28:27 PM5/16/22
to Kivy users support
With much more work than I wanted, I managed to make zbarcam example work.

It was truly a mexican soap opera. As I couldn ́ t make VirtualBox to debug my phone (red a lot of docs), I decided to switch back to install on my bare machine, then I could transcript logcat messages.

I managed to build an APK of kivy-garden zbarcam example, and It was very slow, but It did run.

I then made a copy of buildozer.spec file to my app, and then changed parameters.

The APK was generated, and then I typed on terminal:

buildozer -v android deploy run logcat > ../teste2.txt

The file is attached here.

Looking for suggestions.

teste2.txt

Robert

unread,
May 16, 2022, 8:54:00 PM5/16/22
to Kivy users support
With a big log the first thing to do is look for "traceback"

05-16 18:52:11.488 27972 28650 I python : Traceback (most recent call last):
05-16 18:52:11.489 27972 28650 I python : File "/home/ubuntu/Downloads/teste-cobaia2/.buildozer/android/app/main.py", line 5, in <module>
05-16 18:52:11.489 27972 28650 I python : File "/home/ubuntu/Downloads/teste-cobaia2/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/mkt24h/armeabi-v7a/kivymd/__init__.py", line 40, in <module>
05-16 18:52:11.490 27972 28650 I python : File "/home/ubuntu/Downloads/teste-cobaia2/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/mkt24h/armeabi-v7a/kivy/__init__.py", line 138, in require
05-16 18:52:11.491 27972 28650 I python : Exception: The version of Kivy installed on this system is too old. (You have 1.11.1, but the application requires 2.0.0)

I don't know why your app would use Kivy 1.11.1 , current default is 2.1.0 which is almost certainly what you should use.
Reply all
Reply to author
Forward
0 new messages