Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting with Android: Java or Python (SL4A)

I just ordered an Android smartphone and want to start playing around with creating my own applications. Now the question is which language to use, the native Java or Python using SL4A (former ASE).

I tend to Python, as I know it much better than Java, but I'm wondering what I would be missing using a "second class" language on Android. On the SL4A website it is also stated to be alpha quality software, which is not exactly encouraging.

I'm also not quite sure what the limitations of the scripting environment are and if they would be problematic.

like image 614
Mad Scientist Avatar asked Jul 27 '10 19:07

Mad Scientist


4 Answers

At the moment you cannot create a releasable program with Python (or any other scripting language) using SL4A. I have heard rumours that this is something Google is working on, but even if they do enable it Python apps are likely to be slow and power-hungry compared to Java. Also the scripting API only gives you access to a limited subset of the native Java API. I would not consider using SL4A for serious development work at the moment, only for one-off scripts and prototyping.

Take a look at Scala. It is a statically typed language on the JVM, but uses type inference to remove most of the noise that you get in Java. It also fully supports functional programming, and has a lot of pythonish features. Because it is statically typed it is as efficient as straight Java with none of the disadvantages. IMHO it is the language that Java should have been in the first place.

A lot of people are blogging about using Scala on Android, so Google around for more information.

like image 110
Dave Kirby Avatar answered Oct 18 '22 03:10

Dave Kirby


More likely will depend what type of applications you will develop.

I would start with Java to become familiar with Android SDK. Anyway first you need to look into some examples, tutorials. Most of them are done in Java, and only a few, probably on the dev site of SL4A for that.

Also there is native development Android NDK, that can be programmed with C++.

But anyway Java rules for general applications.

like image 35
Pentium10 Avatar answered Oct 18 '22 01:10

Pentium10


Adding an update to Dave Kirby's answer:

Issue 55, Distribute scripts as APKs, in the issue tracker at SL4A deals specifically with that.

There is a solution being worked out (may be complete by now) described at SharingScripts. The only issue seems to be that you need to have a interpreter APK already installed.

like image 2
Christopher Mahan Avatar answered Oct 18 '22 03:10

Christopher Mahan


you may want to check out Ruboto it is a framework for developing Android apps based on JRuby which means your JRuby code can call Android APIs and can also be called back from the Android Java side. Here is an introduction article .

like image 1
31 bit Avatar answered Oct 18 '22 03:10

31 bit