If you have the time and the resources, the simple solution is to write two apps. Start on whichever platform you feel most comfortable with, then port (or hire someone to port) your app to the other operating system. But the reality for most indie developers is that they don't have the required time or the resources. Even large corporations that have the ability to create two separate apps are hesitant to do so because of the amount of work required to support and maintain two applications over the life of a product.

Fortunately, writing one app for iOS and another for Android is not the only option. The number of cross-platform technologies and tools for mobile devices is growing in terms of quantity and quality.

Terminology

If you're new to the mobile space, you may be curious about the difference between a native and a cross-platform approach to mobile applications. In general, native development means using the platform-specific tools provided for the mobile operating system. In the case of Android, this normally means Java and the Android SDK (software development kit).

Mobile cross-platform development approaches vary greatly. There are web apps that run inside of a browser (either standalone or embedded into a container to more closely mimic a native application). There are also approaches that include their own runtime, like the now defunct Adobe Air. And there are tools that allow you to write the code in an abstracted scripting language, and then generate native code at compile time.

Each of these development techniques has advantages and drawbacks. My suggestion is to try to approach each project with an open mind and do your best to select the tool that fits best for a particular scenario.

Background

I have written a number of Android applications. Most of these are commercial business applications in various vertical markets, and all but one were created as native Android/Java apps — the exception being a web app.

Last year I wrote and released a game; it, too, was a native Android/Java application. While I was pretty pleased with the end result, the thought of starting my development effort over kept me from releasing an iOS version. When I began working on my second game (due out later this year), I chose to move away from the native Android programming environment and use Corona SDK.

Corona SDK is a cross-platform technology that utilizes Lua scripting to abstract the application development from a specific mobile operating system. The application can be tested on a simulator and then compiled into native code for Android or iOS. What follows are some pros and cons I hope will be of interest to developers considering Corona SDK for an upcoming project.

Observations

Pros

In general, it takes significantly less code to implement a given functionality with Corona than the Java equivalent. In particular, dealing with REST services and OpenGL are greatly simplified by Corona.

The Corona simulator runs circles around the Android emulator Google ships with its SDK. It is very easy to change the skin of the Corona simulator to represent a wide array of Android and iOS devices.

Corona scales graphics brilliantly. The system used by Corona for choosing the best asset for a particular device, as well as its ability to auto-scale, seems more intuitive than the native Android approach, and it seems to work better as well.

Setting up the development environment takes just minutes and is much less convoluted than installing Android's Eclipse/SDK/plugin environment.

A Corona app's biggest advantage: It compiles for both iOS and Android.

Cons

Debugging Corona applications can be painful. I have not found a good IDE or debugger, and the result is troubleshooting even simple issues can be tedious.

Lua's loose syntax is ugly. Even an experienced and disciplined programmer will have to work very hard not to end up with spaghetti code. Corona's storyboard API helps when it comes to organizing the code, but compared to a strictly typed and scoped Java application, it leaves a lot to be desired. With Corona, it is very easy to introduce memory leaks; plus, it can be a bear to find those leaks.

Some seemingly simple user interface elements have zero or crude support. A good example is popping up and using the keyboard on a device with a standard input field. This is a pretty common occurrence for a large number of applications, yet the limited support for this in Corona can result in a clunky or non-standard user interface.

Corona's biggest drawback: Google's Android SDK and Apple's iOS development kits are free. There is free edition of the Corona SDK, but you really need to shell out $600 for the Pro version to get the full set of features. More than that, Corona works on a subscription model, so you have to take that $600 hit every year to keep your subscription current.

Just how different is Corona development vs. native Android development?

Below are "hello world" examples implemented using Google's SDK and Corona's, respectively. It is impressive how little code is required in the Corona version. At the same time, the resulting application doesn't look particularly like an Android or an iOS app; this means that everything you do with Corona will be more or less a custom implementation. If you want your app to have the look and feel of the other apps that ship with the user's device, you may find yourself struggling. Furthermore, Corona apps largely ignore systemwide settings like themes and locales.

Native Android Hello World

packagecom.authorwjf.helloworld;

import android.app.Activity;

import android.os.Bundle;

import android.widget.TextView;

publicclassHelloWorldActivityextends Activity {

/** Called when the activity is first created. */

@Override

publicvoid onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

TextView text = new TextView(this);

text.setText("Hello World!");

setContentView(text);

}

}

Corona SDK Hello World

local myTextObject = display.newText( "Hello World!", 0, 0)

Conclusions

Corona SDK is one of many cross-platform tools. Corona is clearly targeted at game development and for that purpose I have been pleased with it. That said, after using it for several months, I do not recommend it for a traditional business app (despite what the Corona website claims). While it greatly simplifies graphics manipulation, it complicates widget-heavy user interfaces.

What do you think?

Have you used Corona SDK? How about other cross-platform tools for developing mobile applications? Sound off in the discussion below to share your experiences with other developers.

Related Topics:

About William J. Francis

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...

Full Bio

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intelligence Corps. Throughout his career William has published numerous technical articles, as well as the occasional short story.