Configuring buildozer.spec for zmq

485 views
Skip to first unread message

Alan Yorinks

unread,
Aug 26, 2016, 10:49:20 AM8/26/16
to Kivy users support
I have a Kivy application that integrates with zmq and msgpack. I can successfully run the application in a Linux environment. When I build the same application with buildozer and install on Android, the application crashes before displaying to the screen. I looked a the logcat files, and not being very knowledgeable about Android, do not see any obvious reasons for the crash.

To help simplify things and to prove to myself I can configure the buildozer.spec file with a p4a recipe, I simply imported umsgack into my application, called some methods to encode and decode a string and use that to create the text for a button label. 

Here is a snippet of what I changed in the spec file to get this to work:

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements
= kivy,umsgpack,zmq


# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
requirment
.source.umsgpack = /usr/local/lib/python3.5/dist-packages/pythonforandroid/recipes/msgpack-python

I tried something similar with zeromq. I am only importing the file and not using any methods in zeromq to simplify things.

I added the following to buildozer.spec:

requirment.source.zmq = /usr/local/lib/python3.5/dist-packages/pythonforandroid/recipes/pyzmq




Here is my python main.py file:

__version__ ="1.0"
from kivy.app import App
from kivy.uix.button import Button
import umsgpack
import zmq


class TestApp(App):
   
def build(self):
        s
= umsgpack.packb('bye bye')
        q
= umsgpack.unpackb(s)
       
print(q)


       
return Button(text=q)


TestApp().run()


If I comment out the import zmq line, then the program can be loaded and run on the anrdoid device.

I also tried adding the following permissions to the .spec:

android.permissions = INTERNET,ACCESS_WIFI_STATE,ACCESS_NETWORK_STATE

Nothing changed by doing so. Any suggestions of what I am doing wrong would be appreciated.

Alan Yorinks

unread,
Aug 29, 2016, 12:25:55 PM8/29/16
to Kivy users support
Has anyone had success using the existing pyzmq p4a recipe? I really would like to get this going if possible My examples above use kivy 1.91 and buildozer 0.33 dev.

Travis Hoogendoorn

unread,
Aug 30, 2016, 11:57:02 AM8/30/16
to Kivy users support
Holy crap! I was not aware that a zmq recipe existed. Will this project be open? If you commit this to a github repo, I could maybe take a look after work, as I would love to get kivy and zmq working together for one of my projects.

Alan Yorinks

unread,
Aug 30, 2016, 2:44:09 PM8/30/16
to Kivy users support
I put a hacked up version of the code at: https://github.com/MrYsLab/kivy_zmq_test

This code demonstrates sending a msgpack message over ZMQ from the GUI to a zmq monitor program that will display the message. I have not implemented anything in the other direction as of yet.
The readme should get you started, but please ask if you have any questions.

There is also the buildozer.spec that I used to create the unworking APK.

FYI, I was able to successfully build a simple GUI and APK that uses msgpack locally on the gui. I was able to encode and decode text and modify a button label with that text. 

BTW, if you want to see some information on some other zmq work I have done, take a look at: http://mryslab.blogspot.com/search/label/IntroXideco

and

Alan Yorinks

unread,
Sep 17, 2016, 12:12:38 PM9/17/16
to Kivy users support
Travis,
   Any success with this?
Reply all
Reply to author
Forward
0 new messages