Search code examples
androidpython-2.7firebasekivybuildozer

Implement python-firebase in android


I have python 2.7.6, the newest kivy and buildozer installed. Now I want to use firebase for python, downloaded by: sudo pip install python-firebase.

I can add this to the requirements in the buildozer.spec file as python-firebase. This all works fine and in the folder .buildozer/applibs/ I got:

firebase, python_firebase-1.2.dist-info, requests, requests-2.9.1.dist-info.

So I expect that I could import firebase in my application, but that doesn't work. when I add: from firebase import firebase the app on android can not even run (I see the kivy app logo, but then the app shuts down).

Can anyone explain me why and what the next steps are?

edit 1: I/python (14201): File "/home/notwaka/Desktop/App/.buildozer/android/app/_applibs/firebase/__init__.py", line 3, in <module> I/python (14201): File "/home/notwaka/Desktop/App/.buildozer/android/app/_applibs/firebase/async.py", line 1, in <module> I/python (14201): File "/home/notwaka/Desktop/App/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/multiprocessing/__init__.py", line 84, in <module> I/python (14201): ImportError: No module named _multiprocessing I/python (14201): Python for android ended.


Solution

  • The multiprocessing module is not supported in Android due to incompatibilities with bionic (Android's libc). I would suggest trying to use the Firebase Android SDK via pyjnius, or just make web requests using Kivy's UrlRequest or via Twisted - it's just a REST API, after all.