4 ms·
Can micropython be used to make Android apps?
by supergreg 11y ago
Can micropython be used to make Android apps?
- cushychicken 11y agoYou could likely interface with Android using MicroPython's wifi interface (which will almost certainly be included in the upcoming ESP8266 release) or using the micro:bit's Bluetooth Low Energy link.
- dbcurtis 11y agofirst, lets be clear about Micropython, the software versus PyBoard, the reference hardware. Micropython on a Pyboard is runnunig on bare metal with no OS. Micropython is very portable, and builds nicely on Linux, yielding a nice small-footprint Python. I am not aware of a build for Android, but it seems like it should be straightforward. Everything about Micropython is tuned for low memory footprint, so it might be a great tool for Android aps.
- unwind 11y agoBut Android is based on Linux, i.e. it wouldn't allow MicroPython to run directly on the bare metal. So that would seem to make actual Python a better candidate for Android porting. I found http://qpython.com/ http://qpython.com/ which seems interesting, but the site didn't look finished.
- inclemnet 11y agoPython indeed runs fine on Android once you can get it to compile (the interpreter needs to be patched to compile with bionic, or can be compiled without patches using the CrystaX NDK). The Kivy graphical framework has the associated python-for-android project [1] taking care of doing this plus including other components like Python modules (including complex ones like numpy) and can compile with different kinds of backend (not just Kivy). There are also other projects running Python on Android in different ways. [1] https://github.com/kivy/python-for-android https://github.com/kivy/python-for-android
- dbcurtis 11y agoYes, it would run on Android the way it runs on Lunux, as an OS process. The benefit is extreme parsimony with respect to RAM use.
- rupellohn 11y agoFor regular Android apps using Python you might want to look into Kivy: https://kivy.org/docs/guide/android.html https://kivy.org/docs/guide/android.html
- ecopoesis 11y agoYou'd be better off trying to to use Jython (which compiles Python to JVM bytecode) because that would give you interop with Android's Java libraries.
- inclemnet 11y agoI'm not aware of anyone having succeeded with Jython - I think there are technical issues but I'm not sure what's the nature of the problem. One option for interacting with java from python is to use tools like pyjnius (http://pyjnius.readthedocs.org/en/latest/ http://pyjnius.readthedocs.org/en/latest/) - this is what e.g. Kivy does to get system information like screen metrics.
- pfalcon 11y agoMicroPython Android support mentioned above is exactly inspired by pyjnius. My initial interest for uPy Android is to just hack on Android, not produce walled-garden (APK) apps. But I intended to post about this effort on Kivy list to see if someone might be interested. The idea might be to have something small, like https://love2d.org/ https://love2d.org/ , but in Python. Note that I myself not really interested in cloning love2d, but if some readers of these comments would find idea interesting and could spread the word to Kivy circles, that would be appreciated (you never know what may come up if wide community gets involved - that's the beauty of Open Source).
- pfalcon 11y agoI started Android port: http://forum.micropython.org/viewtopic.php?f=15&t=898 http://forum.micropython.org/viewtopic.php?f=15&t=898 . It's primary goal not to make normal Android apps (.apk's), but to access Android APIs from command line (like adb). Here's quick example what it can do: https://github.com/pfalcon/micropython-projs/tree/master/android https://github.com/pfalcon/micropython-projs/tree/master/and... . I also have an OpenGLES example someone which turns out I missed to push. Of course, I though about making "normal" apps too, but that would be a long way and bunch of effort. With ESP8266 port kickstarter, Android port is put on hold.