What are the limitations of Python on Android?
Asked Answered
F

3

28

I am getting ready to start a little Android development and need to choose a language. I know Python but would have to learn Java. I'd like to know from those of you who are using Python on Android what the limitations are. Also, are there any benefits over Java?

Formative answered 22/7, 2012 at 12:38 Comment(3)
You can start off with this thread: #3347470Kenogenesis
Nice link dorian. Thank you for it.Yarborough
Thanks for the link. It is good but two years old.Formative
O
17

I investigated this recently for similar reasons. My conclusions were that I could not use Python to develop a native-looking application, which is what I wanted at the time. Specifically:

  • Python can't receive callbacks from the Java UI classes, so you can't use any native Java UI elements such as ListView, etc. Only dialog boxes etc. are easily available. If you have a totally custom UI such as a game, you can try PyGame for Android, or you could look at Kivy, which also uses PyGame.

  • Packaging of Python applications is very difficult, especially because the Python interpreter is not included on Android by default. The Kivy and PyGame teams are making some intermittent progress on this.

  • Because of the aforementioned issues, Python is essentially never used to make full fledged applications published in the app store, and so the literature on how to handle the many sundry issues with SL4A (Scripting Layer For Android) is very thin.

So, if you want to make an application that uses native UI elements, that you can actually distribute in the Play Store, or both, Python is regrettably not an option.

Otte answered 22/7, 2012 at 16:51 Comment(3)
You can package for Play Store and you can build a GUI using webviews and any HTML5 stuff. jQuery Mobile UI works well for simple stuff. I have a jQuery Mobile and Python based app that is packaged as an installable APK, with the interpretor and all the rest of it included. It's a one click install from Play.Carma
@CarlSmith Thanks for the tip. What do you use to bundle the interpreter? Do your users have to install the SL4A package?Otte
I used the code from this project (code.google.com/p/android-python27) and went from there. It gives you all the hooks you need, but it's a shitty workflow until you get things set up. You don't need Eclipse, but it's best to use it at first and see how it fits together.Carma
P
25

Most of the points mentioned by Andrew stand, I just wanted to mention that python can be and is used for full fledged Apps published on GooglePlay and even iOS. I can't speak for other frameworks but here are some examples of Apps published using Kivy.

  1. Process Craft Google Play iOS
  2. Fantasy War hammer
  3. PreseMT is a multitouch presentation maker
  4. Memo robots
  5. Ground Truth
  6. Kaleidoscope
  7. Showcase demo example from Kivy project
  8. DefelectTouch game iOS
  9. Bargenius and many more...

On Packaging we have tried to make it as simple as possible, we also provide

  • A pre-built VM that can be used to make your apk with you having to do nothing except copying your project dir over and running one command.

On GUI, yes the ui is custom, by default(tries to match Android's Holo theme). However it can be customised to resemble other look and feels, although I haven't tried it personally.

Oh and as long as one is talking about python based apps on android, I found this project mentioned on stackoverflow PyMob, their apps page mentions some interesting apps .

Petrina answered 5/8, 2012 at 22:11 Comment(0)
O
17

I investigated this recently for similar reasons. My conclusions were that I could not use Python to develop a native-looking application, which is what I wanted at the time. Specifically:

  • Python can't receive callbacks from the Java UI classes, so you can't use any native Java UI elements such as ListView, etc. Only dialog boxes etc. are easily available. If you have a totally custom UI such as a game, you can try PyGame for Android, or you could look at Kivy, which also uses PyGame.

  • Packaging of Python applications is very difficult, especially because the Python interpreter is not included on Android by default. The Kivy and PyGame teams are making some intermittent progress on this.

  • Because of the aforementioned issues, Python is essentially never used to make full fledged applications published in the app store, and so the literature on how to handle the many sundry issues with SL4A (Scripting Layer For Android) is very thin.

So, if you want to make an application that uses native UI elements, that you can actually distribute in the Play Store, or both, Python is regrettably not an option.

Otte answered 22/7, 2012 at 16:51 Comment(3)
You can package for Play Store and you can build a GUI using webviews and any HTML5 stuff. jQuery Mobile UI works well for simple stuff. I have a jQuery Mobile and Python based app that is packaged as an installable APK, with the interpretor and all the rest of it included. It's a one click install from Play.Carma
@CarlSmith Thanks for the tip. What do you use to bundle the interpreter? Do your users have to install the SL4A package?Otte
I used the code from this project (code.google.com/p/android-python27) and went from there. It gives you all the hooks you need, but it's a shitty workflow until you get things set up. You don't need Eclipse, but it's best to use it at first and see how it fits together.Carma
K
4

I have developed Android Apps on the market, coded in Python. Downsides:

  1. Thus far my users must download the interpreter as well, but they are immediately prompted to do so. (UPDATE: See comment below.)
  2. The script does not exit properly, so I include a webView page that asks them to goto:Settings:Apps:ForceClose if this issue occurs.
Kiel answered 6/10, 2012 at 9:45 Comment(1)
I've ported ALL my sl4a apps to eclipse apk, it embeds with the python interpreter, no need to install anything but the app off google play! A) Android Eye (Computer Vision), that takes a picture and tells you what it is (Object Recognition): play.google.com/store/apps/details?id=com.androideye.androideye B) See Say (OCR) Picture to Speach, for the visually impaired. You can literally have it read a book: play.google.com/store/apps/details?id=com.seesay.seesay D) Standardized IQ Test (based on the Stanfod-Binet): play.google.com/store/apps/details?id=com.iqtest.iqtestKiel

© 2022 - 2024 — McMap. All rights reserved.