Running Your Android Application on an Android Device

From RAD Studio
Jump to: navigation, search

Go Up to Android Mobile Application Development

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 File > New > FireMonkey Mobile Application - Delphi.
  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 | 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. 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.


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