Today Embarcadero released RAD Studio XE5 which lets you build apps for Windows, Mac, iOS and Android. You can also buy Delphi XE5 separately if you prefer.
Embarcadero’s release cycle is relatively rapid. It was only six months ago that RAD Studio XE4 with iOS support appeared.
The big deal in this release is Android support. If you use the FireMonkey framework, you can build apps for all supported platforms.
There is also a new REST client library and some other enhancements – see here for a list of what’s new.
Embarcadero’s approach to Android development is distinctive. In keeping with Delphi’s tradition of native code compilation, Android apps are compiled using the NDK (Native Development Kit). Embarcadero’s developer evangelist John Thomas told me that this delivers excellent performance. I can believe it, though note what Google says:
Before downloading the NDK, you should understand that the NDK will not benefit most apps. As a developer, you need to balance its benefits against its drawbacks. Notably, using native code on Android generally does not result in a noticable performance improvement, but it always increases your app complexity. In general, you should only use the NDK if it is essential to your app—never because you simply prefer to program in C/C++.
Delphi developers are largely shielded from the complexity of the NDK, since you code using the high level abstraction provided by the runtime library (RTL) and the FireMonkey framework. If that is all you need I should think everything will be fine. If you have a Java library you need to call from your Delphi Android application, you need to use JNI (Java Native Interface) which is not so much fun.
Another point to note is that FireMonkey emulates most visual controls like buttons and lists, by drawing them itself. Users might not notice, if they look and behave exactly like the native controls, but this is hard to do perfectly. Embarcadero’s approach is native in respect of the code it generates, but not in respect of the controls it uses.
I installed RAD Studio XE5 on a Windows 8 machine and set about building an Android app. I already had the Android SDK installed so I asked the RAD Studio installer to skip the SDK but to install the NDK. As it turned out, I am not sure whether it did or did not (I could not find it quickly), but it was easier to download the NDK manually.
I have previously tried Delphi for iOS, for which the usual approach is to run Delphi (or RAD Studio) in a Windows emulator on a Mac, since the Delphi IDE is Windows only. This approach is not so good for Android development because its hard to attach Android devices to an emulator for debugging. Therefore, a real Windows PC is a better platform for Android development. If you want to target iOS as well, you can still do so, by using the remote agent running on a Mac.
Setting up for Android development is a little harder than setting up iOS development. The Android device I used for my test is a Sony Xperia T, and I installed the Sony PC Companion to be sure of having the correct USB drivers for debugging. With Java, the SDK, the NDK, RAD Studio itself, and getting the device connected, that is a fair number of moving parts.
It worked though. I created an Android app, connected my Xperia, and it showed up as a target in Delphi (it is also called the LT30p).
I threw a label, a listbox and a button onto my app’s main screen.
As it turned out, I should have taken a little more trouble. Here is my app running on the phone:
Something has gone wrong with the list, but it looks easy to fix.
According to Embarcadero, a recent survey of over 1300 Windows developers showed that 85% get requests for mobile apps. But what mobile platform is most requested? Android is apparently at the top of the list:
- 83% Android
- 67% iOS
- 33% Windows Phone
- 17% Windows RT
- 14% Blackberry
Is that really Windows RT (ARM) or could it include WinRT (Windows 8 Store app) I wonder? Neither are supported by Delphi yet; but at least with Android it now supports the most highly requested platform.
Cross-platform mobile development is critical today, and the new capabilities in Delphi and RAD Studio will be welcome. Is it the best approach? The trade-off is this. On the plus side, you get a cross-platform GUI framework that lets you share the maximum amount of code across all the targets you support. On the minus side, that might not be a good idea; see this post for some thoughts on that. You also get a native executable that should perform well, certainly better than an HTML/JavaScript approach, though I’m not convinced that using the NDK on Android is ideal.
How big is your Delphi Android app? Using the Hello World example above, this is what I got in debug configuration:
24.52MB storage. I changed to release configuration and got this:
That saved nearly 3MB, to 21.62MB.
Here is the RAM usage:
I would be interested in hearing from developers using Delphi or C++ Builder for Android development. How is the quality of this first release? Is the fact that you are not developing in Java a problem in practice?
A bunch of links related to XE5 release can be found: here
Is a 21 MB “hello” app big for Android? Well, a similar app developed with Eclipse and the Free Pascal JVM byte-code compiler has an .apk that’s 158Kb, or 350Kb unzipped.
So is 21 MB too big? Probably not, as assets included with the app often dwarf its executable file(s).
Will a 21 MB executable increase the app’s memory footprint too much? Again, probably not – since the focus in a mobile device is usually one app at a time, other apps can be shut down to free memory for the currently focused app.
The question for XE5 or any tool is whether you can create a great user experience and easily and fully utilize the android.jar runtime.
As for commissioned surveys, well the client usually gets what it pays for.
The only surprise there is that Windows desktop developers, MS’s last best hope, don’t seem very interested in becoming Windows mobile developers. One more measure of just how deep the trouble is that MS is in.
Interestingly enough XE5 FireMonkey’s Canvas seems an order of magnitude slower on desktop Windows than HTML5/JS in Chrome for common operation (drawing lines, text, etc.).
Haven’t tested XE5 Android yet, but should be interesting to see how it goes.