Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
Delphi

Delphi Android 64-bit Support in RAD Studio 10.3.3

In this post, we’ll show you the main features of the just released RAD Studio 10.3.3 the Delphi language support for the Android 64-bit platform.

Android 64-bit Delphi Support

Platform support is provided by a new Delphi compiler for the Android 64-bit platform, which, like the Android 32-bit counterpart, is based on the LLVM compiler infrastructure (and the iOS compilers). This compiler continues to use the ARC memory model in order to reduce the migration effort required by Google for store submissions. The IDE allows you to add the new platform to an existing project, compile and debug it, and then deploy it to the store (more on this later).

All of the libraries we support on Android are available, from RTL to FireMonkey, form database access with FireDAC to Parallel Programming Library, so your code should migrate fairly smoothly. There is also support for InterBase 2020 (just released) on Android 64-bit.

Android 64-Bit Caveats

There are a few hurdles to consider when you start building Android 64-bit applications The biggest issue is that about 50% of Android devices out there have a 32-bit CPU, or they have 64-bit CPU but run a 32-bit version of the OS, and therefore cannot run 64-bit Android applications.

If you want to verify your Android device CPU can run 64-bit apps one option is to use existing apps on the Play Store, like the following:

  • AIDA64 (check the information in the CPU page)
  • CPU-Z (check the System page)

If it indicates your CPU has 64-bit ARMv8-A instruction set, but it is set in 32-bit mode, it implies the Android version is not 64-bit. In case of a mismatch, at the moment you’ll get a specific error message when running a 64-bit APK, but a not-co-clear error message when you try to debug.

Notice also that adding new 64-bit platform doesn’t automatically add all deployment files and additional Java libraries, these might needs some fine tuning as part of the project migration. You can also consider creating a new project file (dproj) from scratch with all the correct defaults.

64-Bit Code Migration is Generally Smooth

In most cases, your Delphi code will just recompile on 64-bit platforms, and you can a larger address space — one you’d likely never use on your phone.

What is different in practice is that pointers, object references, string references and any other data type referring to a memory location becomes a 64-bit, 8 bytes pointer. This also implies that SizeOf (Integer) is now different from SizeOf (Pointer). In fact, Integers remain 4 bytes while the NativeInt type depends on the platform (4 or 8 bytes on 32-bit and 64-bit, respectively).

If you are doing any pointer math or have code that depends on data structure alignment, you might have to change it. And the same if you are type casting Integers to pointers. If you are doing low level calls to native libraries, you might also need to adjust the code.

Android App Bundle Support

The other relevant feature that Delphi 10.3.3 is introducing for Android developers is the support for the AAB format (Android App Bundle). This is a deployment file format capable of bundling both 32 and 64 binaries and files, aimed to store submission — you cannot install a bundle on your phone directly. Similarly to Apple Universal format, once you upload a bundle the end user downloading via the Play Store will just receives the proper files for the specific device (and its bitness).

To enable App Bundlesupport, you can use the matching compiler option for the 64-bit Android target:

You’ll also need to provide proper provisioning information and you can generate this from the IDE, the .aab file to upload to Google Play Store.

Do you want to build an Android app? Try the Android App Builder Software, which will assist you in developing apps in the Delphi or C++ environments.
See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Marco is one of the RAD Studio Product Managers, focused on Delphi. He's the best selling author of over 20 books on Delphi.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES