Include the PySerial library in the kiwi distribution

I am working on a small python script that will run on Android using kivy. I am mostly new to Python programming. The script itself works on my Linux computer, but I can't get the PySerial library compiled for Android. I tried it using buildozer, which debugs the app, but it crashes on Android when I open it. Building an apk with python for android gives me the following error

Run pymodules install
We want to install: serial
Check if and /usr/bin/pip2 are present
Check if virtualenv is existing
Installing virtualenv
./distribute.sh: line 119: --python=python2.7: command not found

      

Is there a way to include a sequential library so that it can be used on Android?

EDIT

error log:

[INFO              ] Logger: Record log in /data/data/org.led.serialled/files/.kivy/logs/kivy_14-08-25_10.txt
[INFO              ] Kivy v1.8.0
[INFO              ] Factory: 157 symbols loaded
[DEBUG             ] Cache: register <kv.lang> with limit=None, timeout=Nones
[DEBUG             ] Cache: register <kv.image> with limit=None, timeout=60s
[DEBUG             ] Cache: register <kv.atlas> with limit=None, timeout=Nones
[WARNING           ] stderr: /data/data/org.led.serialled/files/lib/python2.7/site-packages/kivy/core/image/img_pygame.py:12: RuntimeWarning: import cdrom: No module named cdrom
[WARNING           ] stderr: (ImportError: No module named cdrom)
[INFO              ] Image: Providers: img_tex, img_dds, img_pygame, img_gif (img_pil ignored)
[DEBUG             ] Cache: register <kv.texture> with limit=1000, timeout=60s
[DEBUG             ] Cache: register <kv.shader> with limit=1000, timeout=3600s
[WARNING           ] stderr: Traceback (most recent call last):
[WARNING           ] stderr:   File "/home/konstantin/Desktop/buildozer_LED/.buildozer/android/app/main.py", line 3, in <module>
[WARNING           ] stderr:   File "/home/konstantin/Desktop/buildozer_LED/.buildozer/android/app/_applibs/serial/__init__.py", line 21, in <module>
[WARNING           ] stderr:   File "/home/konstantin/Desktop/buildozer_LED/.buildozer/android/app/_applibs/serial/serialposix.py", line 15, in <module>
[WARNING           ] stderr: ImportError: No module named termios

      

+3


source to share


2 answers


This means any library, if it is a pure python lib or has a known recipe , then just add it to the requirements section of bulldozer.spec.

# requirements of the app
requirements = pyserial,pycrypto,pyasn1,pyjnius,twisted,kivy

      



However, if the lib is not pure python, you need to provide a recipe if it doesn't already exist here , which is nothing more than a simple script that adds patches to the lib to compile it for arm android. Then add it as a requirement for bulldozer.spec.

pyserial looks like pure python lib

+1


source


You have added pyserial

to the requirements above and removed the terms from the blacklist.

In yours, buildozer.spec

use:



# (list) python-for-android whitelist
android.p4a_whitelist = lib-dynload/termios.so

      

or add lib-dynload/termios.so

to whitelist.txt for the bootstrap you are using (see   https://github.com/kivy/python-for-android/blob/master/pythonforandroid/bootstraps/sdl2/build/whitelist.txt )

0


source







All Articles