Running Your Android Application on an Android Emulator

RAD Studio provides a default Android emulator for your use. The emulator is named rsxe5_android.exe, and it is located in C:\Users\<username>\.android\avd\. You can either use the default rsxe5_android emulator or create an Android emulator yourself.

Before you run your application on your Android emulator, have your Android emulator already open to save some time.

Android Device Manager with Default RAD Studio Android Emulator, rsxe5_android

To Add GPU Emulation to the Default Emulator

The default emulator (rsxe5_android) does not have the Use Host GPU property set by default. You might find that the emulator runs faster if you enable GPU emulation, as follows:

  1. Open the Android Virtual Device Manager:
    1. Select Start > All Programs > Embarcadero RAD Studio > Android Tools.
    2. In the SDK Manager, click the Tools menu and select Manage AVDs.
  2. Select the rsxe5_android emulator and click the Edit button.
    Note: If the rsxe5_android emulator is not present, you can create your own Android emulator. See Creating an Android Emulator.
  3. On the Edit Android Virtual Device (AVD) dialog box, click New in the Hardware field.
    SelectHWNew.jpg
  4. Add the GPU emulation property and set its value to yes:
    GPUEmulationYes.jpg
  5. Click Edit AVD to save your changes.

To Start Your Android Emulator

  1. Start the Android Virtual Device Manager:
    1. Select Start > All Programs > Embarcadero RAD Studio > Android Tools.
    2. In the SDK Manager, click the Tools menu and select Manage AVDs.
  2. In the Android Virtual Device Manager, select your Android emulator in the list and click Start.
  3. On the Launch options dialog box, click Launch:
    LaunchOptionskh.png
Note: If the rsxe5_android emulator is not present, you can create your own Android emulator. See Creating an Android Emulator.

To Run Your Application on Your Android Emulator

  1. Open your Android application in RAD Studio.
  2. In the Project Manager, enable the emulator as the target platform.
    If necessary, expand the Target Platforms node and double-click the Android target platform. (The active target platform is displayed using a bold font.)
    1. Expand the Android node in the Project Manager.
    2. Expand the child Target node.
    3. Double-click the target Android emulator to activate it. (The active emulator is displayed using a bold font.)
      Note: If the emulator is not shown, right-click the Target node and select Refresh. If the emulator still is not displayed, see Using the Target Node.
    In the following image you can see the default rsxe5_android emulator running, and the target platform setting activated in the Project Manager:
    EmulatorInIDE2.png
  3. In the device selector in the FireMonkey Mobile Form Designer, select the device that matches the emulator you are using. For example:
    • If you are using the default rsxe5_android emulator with its built-in skin, select WXGA800.
    • If your emulator uses the WQVGA400 device, select 3.3" WQVGA Android Phone (240dp x 400 dp)
  4. Run your application:
  5. Compile and deploy messages should appear in the IDE.
  6. If the emulator is not running, the IDE displays: "The selected emulator is not running. Do you want start it?" Click Yes. A "Launching emulator" message is displayed.
  7. Open your emulator screen and watch for the app to appear.
    In the following image you can see a custom Nexus 4 emulator running a simple Hello World! application:
    AndroidEmulatorRunningApp.PNG

RAD Studio builds your application for Android and runs your application on the selected Android emulator. If the active Android emulator is not running, RAD Studio shows a dialog box that gives you the choice to start your Android emulator. If your Android emulator screen is locked, unlock it to access your application.

Android emulators run much slower than real devices due to the ARM platform emulation on top of a non-ARM system; if performance prevents you from using an Android emulator side by side with RAD Studio, see Running and Debugging Your Android Application Remotely. For obvious reasons, emulators also lack some of the features that real devices provide, although you can emulate some of those features such as geo location.

See Also