August 14, 2013

Compiling Android Apps with Delphi

The next version of Delphi will include a new compiler for the Android ARM platform. Here is some information about it.

The next version of Delphi will include a new compiler for the Android ARM platform. It is a native code compiler, producing binary code (and not Java Dalvik bytecode). Up to now, the only option for native Android apps was using C++ and some low level code. Delphi, instead, offers a higher-level language, ARC like on iOS, and easy-to-use visual component offering user interface development, data access, data binding, sensors, internet and cloud support, and much more.

Delphi for Android requires both the NDK and the SDK to be available (they are both free from Google) on the developer machine, as explained by Jim at

Getting back to the Android compiler, this is a sample of the compilation message log:

Checking project dependencies...
Building Droid101.dproj (Debug, Android)
brcc32 command line for "Droid101.vrc"
c:\program files (x86)\embarcadero\rad studio\12.0\bin\cgrc.exe -c65001 "Droid101.vrc" -foDroid101.res
dcc command line for "Droid101.dpr"
c:\program files (x86)\embarcadero\rad studio\12.0\bin\dccaarm.exe -$O- --no-config -B -Q -AGenerics.Collections=System.Generics.Collections;
Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DDEBUG
-E.\Android\Debug -I"c:\program files (x86)\embarcadero\rad studio\12.0\lib\Android\debug";"c:\program files (x86)\embarcadero\rad
studio\12.0\lib\Android\Release" -LE"C:\Users\Public\Documents\RAD Studio\12.0\Bpl\Android" -LN"C:\Users\Public\Documents\RAD
Studio\12.0\Dcp\Android" -NU.\Android\Debug -NSSystem;Xml;Data;Datasnap;Web;Soap; -O"c:\program files (x86)\embarcadero\rad
studio\12.0\lib\Android\Release" -U"c:\program files (x86)\embarcadero\rad studio\12.0\lib\Android\debug";"c:\program files (x86)\embarcadero\rad
studio\12.0\lib\Android\Release" --libpath:c:\android\ndk\platforms\android-14||arch-arm\usr\lib --linker:"c:\program files (x86)\embarcadero\rad
studio\12.0\bin\ldandroid.exe" -V -VN -NO.\Android\Debug Droid101.dpr
Elapsed time: 00:00:04.8

The DCCARM compiler we are using is based on the LLVM architecture, like the Delphi for iOS compiler. This implies using a specific linker (see above!) and an entire toolchain tied to LLVM for building and debugging the application on the device. What is produced by this compilation? Quite surprisingly, it is not a regular executable, but a shared object library, for a project called Droid101.

The reason is that an Android process (or activity) starts invariably with a Java entry point. For an application based on the NDK, you can create a minimal Java class with the only role of loading the native code and call its entry point. Don't worry, though: Delphi will have that class written for you, so all you need to do is write an application as usual and hit the F9 button... As you press F9, after the compilation, Delphi automatically creates an APK (an Android packaged application) with all the required files (manifest, resources, and the binary), deploy the application to your device using platform tools, and start it.

Your device must be enable for debugging (and you might need to install a specific USB driver for the device). There is no need to sign a developer contract with Google for this. There are other ways to deploy the app, though. For example, you could send the APK file as an attachment to a GMail account to any Android user accepting apps from outside of the store, and the user will be able to install your app directly from GMail.

To summarize, Delphi for Android will make it extremely easy to write natively compiled applications calling any NDK or SDK API in a seamless way, and will have the same set of components and visual controls of its iOS counterpart. Single source, multiple platforms, that is.

PS. So if you haven't already done so, buy Delphi XE4 today and take advantage of the maintenance offers as explained on



Compiling Android Apps with Delphi 

Hi Marco,

sorry for being off topic. What's new in Win32 
compiler in XE5? Any new language features?

best regards
Comment by Peter on August 14, 16:23

Compiling Android Apps with Delphi 

 I have a little dongle for my TV that runs Android 4.3 (Jelly Bean, I think). 
It plugs into the TV's HDMI port and uses a WiFi mouse.

You can access Google Play and most other services though it. In fact, it 
looks pretty similar to what's available on my Samsung S3 phone. 

Will Delphi's Android support build apps for non-phone devices like this?

Is there a minimal version of Android that this targets?  1.x, 2.0, 2.1, 2.2, 
2.3, 2.x ?
Comment by David S on August 14, 17:01

Compiling Android Apps with Delphi 

We plan supporting different versions of Android. Jelly Bean for sure. 
Depends on the CPU the device is using and if there are missing libraries.

For now, we'll officially support some of the most popular devices from 
Google, Samsung, and Amazon, but we expect applications to run a 
many more.

We plan officially supporting some "special devices" like TV dongles in 
the future.
Comment by Marco Cantu [] on August 14, 17:10

Compiling Android Apps with Delphi 

"same set of components and visual controls of its 
iOS counterpart"

But Android is not iOS!
Comment by Kent Morwath on August 14, 22:04

Compiling Android Apps with Delphi 

I don't know if I am interpreting this right, but as I 
understand delphi for android won't support devices with 
nvidia processors like the Nexus 7(at least for now). Am 
I right?   

What are the implications to distribute an application 
via Google play. Do native code applications comply with 
their distribution rules? Is it possible? 

I am looking forward for this new version of delphi.
Comment by Carlos on August 15, 00:04

Compiling Android Apps with Delphi 

 right to left supported or not yet?
Comment by ahmed on August 15, 07:11

Compiling Android Apps with Delphi 

C++ wasn't only option for Android. FreePascal code also 
runs on android (for ARMv3, ARMv4, ARMv5, ARMv6 and 
Comment by HNB on August 15, 09:21

Compiling Android Apps with Delphi 

"Buy" you say... If Professional+Mobile cost $250, 
I'd buy it without a moment's thought. If it cost 
$500, I'd buy it after some consideration. When it 
costs $1.5k I really don't know.

What's worse, corporate projects are one thing but 
with open-source you can be sure not many are going 
to care about your project if you code in pascal. 
Even with $200 people are going to be more than just 
reserved about joining, but $1.5k practically 
guarantees that no one will even bother thinking 
about it. Meaning Delphi won't gain popularity.

I'd really like some "hobby/small business" version 
of Delphi which wouldn't feel crippled (i.e.: all 
platforms, VCL with source, all standard components), 
but with license that says "for free/open source 
projects or for projects with revenue stream less 
than [whatever]".
Comment by himselfv on August 15, 11:19

Compiling Android Apps with Delphi 

"But Android is not iOS!"

Indeed. But as long as some people don't get that, i guess there's a 
market for selling them on the hollow promise of Write Once, Run 
Comment by marc hoffman on August 15, 12:47

Compiling Android Apps with Delphi 

 Thank you Marco Cantu. I love the way delphi has come 
up to face the modern demands(mobile apps). Certainly 
Delphi 5 will have everything in Delphi 4 or should i 
buy Delphi 4 before September 6 and get Delphi 5 when it 
is realesed for free.
Comment by Bernard Sibanda [] on August 15, 14:27

Compiling Android Apps with Delphi 

great. i looking everyday , when it's complete ?
Comment by safa on August 15, 17:40

Compiling Android Apps with Delphi 

As I am looking forward to see Delphi for Android, I do 
wonder about its price. An upcoming Google Android 
studio is free vs. Delphi over $1000. It will be 
difficult to convince new developers to even try Delphi 
Android. I wish I have a crystal ball...
Comment by Chris on August 16, 12:09

Compiling Android Apps with Delphi 

Why bother when you have freepascal doing android, ios 
and wince. And lest I forget remobject's oxygene!
Comment by the chief priest [] on August 18, 19:19

Compiling Android Apps with Delphi 

Re: For now, we'll officially support some of the most 
popular devices from Google, Samsung, and Amazon, but 
we expect applications to run a many more.

I've tried the RAD Studio XE4 demo and liked it very 
much. I also understand that  native apps can provide 
access to low level API's ,run very fast(when compared 
to other solutions) and provides the best user 
experience overall for Android. However, RAD Studio 
still seems limited compared to  HTML, CSS and 
JavaScript(which most of us have had to learn just to 
understand the web) and while using Delphi code is 
convenient there is still tons of learning to do to 
use maximize the benefits and features of Rad Studio 
and object Pascal. If I were developing an app for a 
specific company I could see them specifying what 
devices to target and the popular devices from Google, 
Samsung, and Amazon(as you stated) may be OK. However,  
it gets much more complicated if I am writing an app 
for a retail customer and that app will be made 
available on their website but they don't know who the 
users are or what the target devices will be. That's 
the problem with limited devices. My other solution 
would be to use HTML5 builder (appt $300) and Write a 
PhoneGap app once, with HTML and JavaScript,CSS and 
deploy it to any mobile device without losing features 
of a native app but also knowing that some functions 
could be slower that what they would be in a native 

 For example:With HTML5 Builder  I could deploy it to 
iOS, Android™, Windows® Phone, webOS, BlackBerry® and 
more all with one compile of the online phone gap 

RAD Studio may be a benefit to long time Delphi users 
with a code base to work from but it's ability to gain 
new users remains to be seen with such a high cost of 
entry.(NEW USER	 $1,799.00) Eclipse, Android Studio, 
IntelliJ IDEA Community Edition, Windows Phone App 
Studio(just to name a few)are all free. 

Native app speed is only important in certain types of 
apps(for example graphics intensive apps) and many app 
functions would not benefit from any speed increases. 
The speed of the Javascript engines such as 
SpiderMonkey and V8 is continually increasing  while 
CUP's are generally getting faster. According to 
Mozilla, asm.js is already rivaling or beating native 
on some benchmarks i.e. binary-trees. So, compiling 
native has it's merits and is a great buzz word for 
marketing but the reality is that native speed is not 
always necessary for many types of app's or app 
features. Native is not even always the 
fastest(Mozilla's claim). I will give RAD studio full 
points for ease of use, plenty of great features and 
it's RAD support but the current limited set(which 
will get better over time) of supported Android 
devices seems problematic to me for such a high priced 
product. After all, the problem that many of us are 
trying to solve is how to write once and deploy to as 
many devices as possible. :)
Comment by Robert(Bob) Lawrence on August 19, 05:21

Compiling Android Apps with Delphi 

+1 for Bob Lawrence !

This is exactly the situation we found ourselves in
and could no longer wait for Delphi + Android +
Blackberry etc. 

We ended up going the HTML5, CSS, Javascript and
Phonegap route and have successfully deployed across
Android, iOS and Blackberry, Shortly we will be
looking at Windows phone on Nokia.

Speed has not been an issue, we have found network
coverage and quality was more of an issue. 

I admire Emb for their efforts with Delphi and Mobile,
but I feel that the time to market for new features
and capabilities needs to improve.
Comment by Rob on August 19, 09:34

Compiling Android Apps with Delphi Starter 

Hi Marco,
You (I mean the staff) should think about selling the 
android mobility pack for starter edition also (but 
without source code if any).
I know it's a difficult decision but you must give 
Delphi a chance to better ranked in the TIOBE index

Seriously, you can't be satisfyed with current ranking 
? Hobbyists are a good voice publicity, and some of 
them would pay for the android addon. 
Comment by wchris on August 21, 20:20

Compiling Android Apps with Delphi 

Too expensive (and maybee too late)
I do understand that you have to make money with 
business users of delphi. I do not understand why 
Embarcadero abbandonded all open source and hobby 
programmers (like me) with its price politics. Though I 
am Delphi fan since D2 I started with Eclipse and Java 
some time ago. Sure - this won't bother your company. 
But where do you hope to find programmers for delphi in 
10 years if noone starts with a delphi starter edition 
for free now? Actually I can't recommend anyone to get 
started with Delphi any more - and I really regret that!
Comment by Uwe Grassmé [] on August 23, 08:19

Compiling Android Apps with Delphi 

I am returning a dataset by a function to connect with 
Android, but I'm changing the components for the ADQuery 
FireDac but always with access violation error occurs 
with minimal markup as DataSnapCompability = True 

In short, FireDac is compatible with DataSnap to return 
a DataSet? 
Comment by José Nascimento [] on August 25, 19:23

Compiling Android Apps with Delphi 

Completely agree with Uwe Grassmé.

I'm using delphi sine D1 and before that I was using
Borland C++ 3.1.
Now I'm thinking to abandon Delphi and go to Visual
Studio .NET.  I found the help of delphi is very poor
and we cannot find many documentation or examples on
the WEB.

I think that they have to stop making new version
every 6 months and just make the current one very
solid at lower price with very good help and
documentation. Then, I will maybe get confidence again
with Delphi product.

I used to love Delphi very much, the last one I bought
was RadStudio Entreprise 2010 but when I need to open
the help, I go to my old Delphi 6 :( . Since, I'm
always waiting for a solid version wit hvery good help
and documentation before upgrading it... but more the
time past and more I'm looking for new product like
.net because I don't feel any amelioration with
Comment by François Zacharie on August 27, 22:21

Compiling Android Apps with Delphi 

I really would like to Emb release a hobbist version... 
Ok if you (Emb) can't give it for free, but 1.7K is too 
much for me. 
Look at the market, and as someone told here, there are 
other options to compile Android, but I would prefer 
People are unable to find newest tips for Delphi because 
of migration to VS and other. Migration is mainly due 
its price policy... At my work we are using C# where 
once used Delphi!! Why? Cheaper, they say.
Maybe still rest a chance for Delphi, it will not depend 
only the product itself, but the pricing policies.
Ignore the hobbyists and will no more exist people using 
Comment by Magno Lima on August 30, 13:26

Compiling Android Apps with Delphi 

+1 to François Zacharie. I completely agree. For many 
years in a row Delphi has gained new features and new 
bugs, however those bugs we all pay for are never 
fixex, or they are fixex only in a new version that we 
have to pay for again. So, we pay for a bug and pay 
for its fix!

I´m not saying Embarcadero should give software for 
free, but what´s the point of releasing a new version 
every year with new features and not fixing the bugs 
in the previous versions? It may be very good for 
Embarcadero to profit over bugs, but for how long will 
this be tolerated?

Many developers abandoned Delphi and new ones are not 
showing just because the company asks for fidelity, 
but doesn´t show any.

Take a look on Microsoft. They release a new version 
of their products but keep maintaining the older ones 
for until 10 years in some cases. This is to care 
about the customer and the customer´s business.
Comment by Alex S. Constâncio [] on August 30, 20:06

3D Rotation in FireMonkey 

I need urgent help...
I need to rotate a cylinder to connect the two spheres
in 3D space ...
Comment by on September 2, 18:02

Compiling Android Apps with Delphi 

Just a word to thanks Marco to let anyone speak freely
on his blog.
I worked for two companies who really support Delphi
for several years. First, both companies don't wait a
delphi compiler for Android because Google provide a
free solution. Second, young developer prefers
investing in Android or iOs rather to learn How to use
Delphi with Android. Third, companies choosed to
target Android before iOs, perhaps EM had make a mistake.
With a great respect for Marco, it is very sad that
his issue on Microsoft could be very close on Delphi's
But on the other side, i will perhaps give a chance to
Xe5 just to play with Android.
I just wonder if xe5 will have possibility to use goo
maps or other libs...
Comment by Olivier Guenard on September 4, 20:22

Compiling Android Apps with Delphi 

A good development system has it's Price ...

Since D1, Delphi has ever been a development system 
that compiled and started the application in a very 
short time.

But what's going on with android ?

Starting an android application (a simple button and 
text box) requires about 5 minutes (if - and only if 
application gets really started) !!

In my opinion the maximum (!) startup time should be 
a few seconds, not minutes.

Ok, I baught a SSD-PCI-Card, deinstalled Hyper-V to 
get HAXM to run... and tried to run AVD on Intel X86 
Atom simulation... 

Will the Startup now get faster ?

No, nothing but an AVD app crash with Delphi...

(seems to be wrong --linker -flag in dcc, so it still 
compiles for arm ?)

My simple test: opening a file which also should be 
deployed to android(project-deployment).

But nothing is deployed on android.

Ok, trying in "32-Bit-Windows" - also no file 

After some days of testing XE5:

Does really somebody develop applications with Delphi 
for mobile devices ? If, please tell me: how do you 
do this ? What should I do to get this delphi Version 
useful running ?

Comment by Adalbert Menhofer on September 17, 17:08

Compiling Android Apps with Delphi 


  I really don't see this slow lag time, as I compile and deploy in a short 
time (like half a minute) I can see the app running.

In same cases I know it might depend on installing the proper USB driver 
(from the SDK). Maybe there is something in your configuration or 
device. While deployment is not very fast, it is generally not as slow as 
you mention.

Deployment to the emulator is another can of worms, as the emulator 
(particularly if not running natively) is very slow in itself.
Comment by Marco Cantu [] on September 18, 07:47

Compiling Android Apps with Delphi 

Marco, I am very impressed with delphi for android. The only reason i 
still use delphi since D3 has to do with the form designer. I now can 
build an application that runs on windows and android. Great!

One caveat: audio support is poor and midi support is non-existent. I 
expect this to be better inthe NDK. Could you tell me where i can find 
information on how to access the NDK directly from delphi? 

I know all objections of directly accessing the ndk (same applies for 
windows api), but as support for midi is non-existent i hope this 
avenue will help.

Comment by arnold on October 2, 15:39

Compiling Android Apps with Delphi 

Despondent looking at the vicious circle. I started using Delphi 
before D2 as I recall, and c++Builder 3, I dunno, I'd have to go look 
at the manuals. I used to LOVE Borland. I don't know about you, 
but my income hasn't kept pace with inflation. I'm an independent 
and i'm not going to pay more than $500 for a tool, and I expect 
something very powerful for that.  A castrated Delphi that doesn't 
address the only possible reasons for buying it, namely cross-
platform iOS, OsX and Android is a joke. 

In addition the claim of native code is meaningless, it apparently 
generates unwieldy and slow code. Even if you make money on 
dinosaur corporate in-house dev, without a nerd culture fan base 
that's enthused, it's a path to disappearance. And when I see your 
prices, I don't even LIKE Embarcadero. 
Comment by Fernando on January 5, 03:15

Compiling Android Apps with Delphi 

  I can partially understand your complain about price, but if you look 
around there are many professional tools you can buy for less than 500 
USD (if you exclude companies that distribute tools for free and monetize 
on platforms). Anyway I can see for some developers this is expensive.

  That native code is meaningless I disagree. In fact, Apple uses native 
code and even Google is starting that push (with a new Java VM that 
compiles on install). It is not slow. Some of the FM platform controls 
might be slow, but that's a different issue to me.
Comment by Marco Cantu [] on January 6, 11:16

Compiling Android Apps with Delphi 

 This is precisely the circumstances we ended up in 
what's more could no more hold up for Delphi + Android 
+ Blackberry and so forth. 
We wound up going the Html5, CSS, Javascript and 
Phonegap track and have effectively sent over 
Android, ios and Blackberry, Shortly we will be taking 
a gander at Windows telephone on Nokia. 
Speed has not been an issue, we have discovered system 
scope and quality was a greater amount of an issue.
Comment by James J [] on January 17, 07:57

Compiling Android Apps with Delphi 

Hi Marco,
reating Android BLE apps does not work for me with XE7:
If I call
I get exception as:
EConvertError with message 'No argument for format
'Error while working with charc''.
What does it mean? Why it is not working?
Similar code works fine in Android Studio.

I tried to run APK on Nexus 9 (ARM Cortex-A15, V7-A).
It crashes very ugly: if the logo should be displayed
(debug or release version, debug with Embarcardero
logo) I get exception as:
EBitmapLoadingFailed with message 'Loading bitmap
Does it mean XE7 cannot generate project and code for
Nexus 9 (running Android 5, Lollipop, even with SDK 19
version set)?

I want to use XE7 for Android BLE apps but so many
trouble. Please, do you have any idea? Thank you.
Comment by Torsten Jaekel [] on November 7, 09:22

Compiling Android Apps with Delphi 

Comment by Marco Cantu on November 13, 09:47

Compiling Android Apps with Delphi 


  a) looks like a string formatting error, or actually a data 
conversion error in a string formatting code. I don't know enough 
of the specific BLE profile, you should ask in a public forum or use 
our support

  b) We have deployed apps to Android Lollipop, not sure about 
testing specifically on Nexus 9 with L. have you tried running any 
existing public Delphi app on the device?
Comment by Marco Cantu [] on November 13, 09:51

Compiling Android Apps with Delphi 


All our android apps compiled with XE5 fail on Android 
5 Lollipop. They work correctly with Android 4.x.

Does somebody else get the problem?



Comment by Serge Chelli [] on November 21, 18:54

Compiling Android Apps with Delphi 

 Hi Serge,
   I have the same problem. Did You use some future of
loading bmp (images) or work on images ? I read that
it's know problem for embarcadero Delphi with lollipop
android. It's wird because all application (nor
written in Delphi) on my Nexus 5 start working in
lollipop (after upgrade Nexus 5) without updating, but
not this one I wrote in Delphi ;-( 

Embarcadero Team please help us. People asking us
about errors in our application !!!!
Comment by Marcin on November 29, 14:20

Compiling Android Apps with Delphi 

 Serge, I've just wrote a blog post on how to apply a workaround and fix 
app crashing on Lollipop:

It's in italian but you can use Google Translator (easily from the right box 
on the blog) and feel free to ask if something is unclear.

Comment by Andrea Magni [] on December 1, 10:01

Compiling Android Apps with Delphi 

Hi Marco,

A couple of days ago the Galaxy S4 and the Note 4  
were updated with the Lollipop version of Android.
After that all our XE5 apps voor Android stopped 
After two days of searching on the internet i found 
out that it is a known problem, which every XE5 
programmers has with Lollipop.

I have seen that there is a hotfix for XE7, but i 
coud not find anything for XE5.

Will there ever be a Hotfix for XE5??
If not, does that mean the end of XE5??? while we 
have spend thousands of euro's for three licenses 
just about a year ago.

Or Is this just a way of Embarcadero to force his 
customers to buy the next version of RAD Studio?

At least please tell us a decent work around, which 
we can easily apply to our apps.

The work around above here(in italian) is not very 
understandable after putting through the google 

I'm hoping to hear from you soon.

With Kind regards

Imtiaz Khan
Comment by Imtiaz Khan on April 29, 14:17

Compiling Android Apps with Delphi 

XE5 was released well over 1 year before Lollipop was released and 
was never meant to support it. Unlike on Windows, backwards 
compatibility on mobile is not that common.

I don't think there will be a Lollipop hotfix for XE5, as there were 
many other changes in XE6 and XE7 that built the foundations for 
that support and would also be lacking. The same patch won't 
really work.

We really think mobile developers should move to a subscription 
plan, so that they can receive new versions of our tools to support 
newer version of mobile operating systems.
Comment by Marco Cantu [] on April 30, 09:43

Compiling Android Apps with Delphi 

Okay, thanks for your quick answer Marco.
Not exactly a satisfying answer, but at least we know 
now where we stand.
Comment by Imtiaz Khan on April 30, 15:05

Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.