Running Your Android Application on an Android Device

After you prepare your development system for Android development, enable USB debugging in your Android device and configure your system to detect your Android device, you can run a FireMonkey mobile application on a connected Android device.

  1. Connect your Android device to your development system using your device's USB cable.
    You should see your Android device listed under Portable Devices in the Device Manager (available from the Control Panel).
    For more information, see Configuring Your System to Detect Your Android Device.
  2. In RAD Studio, select either File > New > FireMonkey Mobile Application - Delphi or File > New > FireMonkey Mobile Application - C++Builder.
  3. In the Project Manager, activate (double-click) the Android target platform.
  4. Enable the Android SDK for your device:
    1. In the Project Manager, right-click the Android node and select Properties.
    2. In Platform Properties, click the down-arrow in the SDK (Software Development Kit) field and select either:
      • Your installed Android SDK version, if it is displayed
      • Add New
        1. In the Add a New SDK dialog box, click the down-arrow in the Select an SDK version field and select your installed Android SDK.
        2. Complete the fields in the Create a New Android SDK wizard. Most of the fields are completed automatically by the wizard.
  5. Enable your Android device as the target platform: In the Android target platform in the Project Manager, open the Target node and double-click your Android device.
    When your Android device is correctly installed, the SDK version number appears after the Android target name; for example:
    Android - Android SDK 22.0.1
    Tips: If your device is not shown, try these steps:
    1. In the IDE, right-click the Target node and select Refresh.
    2. In the Control Panel, open the Device Manager:
      1. Verify that your Android device is listed, typically under Portable Devices.
      2. If your device is not listed, right-click any node and select Scan for hardware changes.
      3. If necessary, use the Android SDK Manager to uninstall and then reinstall the device driver for your Android device. Select Start | All Programs | Embarcadero RAD Studio XE6 | Android Tools.

    The following image shows a populated Android Target node displaying the Nexus 10 device, one emulator that is running, and several emulators that are not running:
  6. If you selected the Application Store platform configuration on the Configuration node of the Project Manager, you must have a signing certificate configured for the Application Store platform configuration on the Provisioning page. The Debug platform configuration does not require a signing certificate.
  7. Run your application:

RAD Studio builds your application for Android and runs your application on the selected Android device. If your Android device screen is locked, unlock it to access your application.

Running Your Application with Clean Data and Cache Folders

When you run an application on an Android device, RAD Studio installs your application on your device using the package name that you defined in the Version Info options page to uniquely identify your application. By default, the package name is "com.embarcadero.$(ModuleName)", where $(ModuleName) is the name of your project, such as "Project1".

If you run your application on a device that already contains a previously-installed application with the same package name as the application that you want to run, the Run command reinstalls your application, but only updates the application executable; your application's data and cache folders are not updated.

To configure RAD Studio so that the Run Without Debugging and Run actions completely uninstall any previously-installed version of your application, including the data and cache folders, before installing the newer version:

  1. Select Run > Parameters.
  2. Enter "-cleaninstall" in the Parameters field:
  3. Click OK to save your changes.


Stuck at "Uninstalling" on the Run Dialog Box

You might need to enable USB debugging specifically for your computer if you are running Android 4.2.2 or later and when you click Run or Run Without Debug, RAD Studio does not go beyond the following screen:


You might also need to enable the general USB debugging setting in your device. If this is the case, your device should show a dialog box asking you to allow USB debugging:


Click OK to allow USB debugging.

If you accidentally click Cancel, disconnect your device from your PC and then reconnect it to make the dialog box reappear on your device.

See Also