The main feature of just released RAD Studio 10.3.3 is the Delphi language support for the Android 64-bit platform.

Android 64-bit Delphi Support

The platform support is provided via a new Delphi compiler for the Android 64-bit platform, based on the LLVM compiler infrastructure like the Android 32-bit counterpart (and the iOS compilers). This compiler still uses ARC memory model, to reduce migration effort to 64-bit that Google requires for store submissions. The IDE offers the ability to add the new platform to an existing project, compile and debug, and deploy 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 Bundle support 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 from the IDE the .aab file to upload to Google Play Store.