Using the Built-in RAD Studio Java Libraries for Android

From RAD Studio
Jump to: navigation, search

Go Up to Using Java Libraries in Your RAD Studio Android Apps

The RAD Studio installation includes a set of Java libraries that are required by FireMonkey as a whole or by certain components and platform services of FireMonkey. RAD Studio also provides one or more Delphi units and C++ header files for each one of those Java libraries. You can include those Delphi or C++ files in your RAD Studio applications to access the API of the underlying Java libraries.

The RAD Studio installation also includes a classes.dex file, which is the result of converting this set of Java libraries into a single Dalvik Executable file. RAD Studio includes the classes.dex file in your applications by default when you deploy your applications for the Android target platform. This file allows your RAD Studio applications to interact with the Android API and the rest of the built-in RAD Studio Java libraries at run time.

List of Built-in RAD Studio Java Libraries for Android

The RAD Studio installation includes the following Java libraries:

Library Native Files Description

Android API


API of the Android platform.

Android Support


Set of libraries that provide a wide array of different features for Android programming.



Library that provides the core functionality required by the FireMonkey Application Platform on the Android platform.

Google Mobile Ads


SDK of the Google Mobile Ads service.

Google Analytics


SDK of the Google Analytics service.

Google Play Application Licensing


License Verification Library, a collection of helper classes to simplify adding licensing to an Android application.

Google Play In-app Billing


API of the Google Play In-app Billing service.

Google Play Services


API of the Google Play services.

APK Expansion


SDK for hosting Android APK expansion files on the Google Play servers.

Cloud Messaging


SDK of the Google Cloud Messaging service.

The FireMonkey Java library is an Embarcadero library. The APK Expansion and Cloud Messaging Java libraries are third-party libraries that include modifications by Embarcadero. The rest of the Java libraries listed in the table above are unmodified third-party libraries.

The files in the Native Files column are the files that you can include in your RAD Studio applications to access the APIs of these Java libraries from your native code. You can find these files in the following paths within the RAD Studio installation folder (C:\Program Files (x86)\Embarcadero\Studio\22.0):

  • Delphi units: source\rtl\android (.pas file extension)
  • C++ header files: include\android\rtl (.hpp file extension)

Some of the features of the third-party Java libraries may require:

Check the official documentation of each third-party library for more information.

Disabling Unnecessary Built-in RAD Studio Java Libraries to Decrease the Size of Your Application

By default, the classes.dex file of any Android application created using RAD Studio includes all the Java libraries listed in the table above. While this ensures that your application always works, it also increases the size of your application package.

If you know for sure that your application does not use some of these built-in Java libraries, such as those for advertising or analytics, you can remove those unnecessary libraries from your project so that they are not included in your application package anymore. You can always add them back later if you need them as your application provides new features.

To remove a built-in Java library from your project:

  1. On the Projects Window, expand the Libraries node within Target Platforms > Android.
  2. Right-click the Java library file that you do not want to include in the classes.dex file of your application.
  3. Select Disable to disable the selected Java library file.

To enable a previously-disabled built-in library, repeat these steps but select Enable instead of Disable.

Updating Built-in RAD Studio Java Libraries

The built-in Java libraries can be changed as part of a new RAD Studio version.

The existing project files need to be updated to use the built-in Java libraries recommended for the RAD Studio version you have installed, otherwise, the generated Android application may experience unexpected issues.

Follow the steps below to get an existing project file ready to use in a new RAD Studio version:

  1. Go to the Projects Window.
  2. Select Android 32-bit or Android 64-bit as the active target platform.
  3. Right-click on the Libraries node.
  4. Click on the Revert System Files to Default menu item.

See Also