How to set up your RAD Studio Delphi development environment to create Android apps

By: Tim DelChiaro

Abstract: Tutorial from the RAD Studio XE5 doc wiki

    Mobile Tutorial: Set Up Your Development Environment on Windows PC (Android)

Go Up to Mobile Tutorials: Delphi Mobile Application Development (iOS and Android)


A FireMonkey application destined for the Android target platform can optionally be tested initially on an Android Emulator running on the Windows development platform. The larger part of the testing process uses the Android Device target platform and requires a test Android device connected by USB cable to your development system. You do not need to use the Platform Assistant in developing apps for the Android target platform. (PAServer is, however, required for developing Mac OS X and iOS apps.)

Note: If you install the Android development tools during your RAD Studio installation, Installing the USB Driver for Your Android Device is the only setup step described here that you need to perform on your PC.
After you complete either this tutorial or the one required step, your next steps are to:

    Contents

 [hide

    Setting Up Your RAD Studio Environment

The following Android development tools are installed on your development system during RAD Studio installation:

  • Java Development Kit (JDK)
  • Android Software Development Kit (SDK)
  • Android Native Development Kit (NDK)

    Android Development Tools Are Installed with RAD Studio

InstallerSDK.png
 

We recommend that you install the Android development tools using our product installer. However, if you already have the Android development tools installed on your system, or if you want to install the tools yourself, you can choose to skip this step in the installer. For specific instructions on installing the Android development tools yourself, see Installing the Android Development Tools.

Default Installed Locations of the Android Development Tools

Java Development Kit (JDK)
  • C:\Program Files\Java\jdk1.7.0_25
    JavaDKLocation3.png


 

Android Software Development Kit (SDK)
  • C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk
    SDKLocationsUsers6.png


 

Android Native Development Kit (NDK)
  • C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\android-ndk-r8e
    NDKLocations6.png


 

    Adding Your Android SDK in Tools Options > SDK Manager

Important:
  • If the Android SDK and NDK are installed during the RAD Studio installation, your Android SDK should be automatically discovered by the RAD Studio SDK Manager, and you do not need to perform this step. Proceed to the next step: Installing the USB Driver for Your Android Device.
  • If you installed the Android SDK and NDK yourself, you need to perform this step so that RAD Studio can build apps that target Android devices.
  1. Select Tools > Options > Environment Options > SDK Manager.
    Here is the SDK Manager when it is fully populated with the recommended Android SDK:
    SDKManager.png

    Note:
    • The SDK Manager fields are blank if the SDK Manager cannot detect the default installed Android SDK and you have not yet added an Android SDK to the SDK Manager.
    • Fields that are marked with YellowBang.png do not have the correct path. Click the [...] in that field and browse to the installed location of the library files.
  2. Click Add.
  3. On the Add a New SDK dialog box, click the down-arrow in the Select an SDK version field, and select Add New... from the drop-down list:
    AddNewSDKpage.png
    Note: If your installed Android SDK is listed in the Select an SDK version list, select your Android SDK.

  4. The Create a new Android SDK wizard is displayed.
    • Complete the first two fields on this wizard: Android SDK Base Path and Android NDK Base Path (their installed locations). Either enter the paths of the installed locations or click the ellipsis [...] and navigate to the installed locations.
    • The YellowBang.png symbol indicates that the base paths are missing, and the Next button is enabled only after these fields are filled.
    • Here is the wizard when no SDKs have been added and the base path fields are empty:
      AndDevKitEmpty.png

      This wizard verifies the base paths you specify and then auto-populates the paths to the various other libraries (that is, the tools on page 2 of the wizard).
      Thus, you might need to enter only the base paths for the NDK and SDK, on page 1 of the wizard. Then the second page will auto-populate, if given a little time. Or you might need to verify the auto-populated addresses (if they are present).
    • Here is the first page of the wizard after you browse to (or enter) the paths to the Android SDK and NDK. There are no YellowBang.png icons because the paths have been verified.
      PathsComplete.png

  5. Click Next to go to the next page of the wizard, where the wizard will attempt to prefill the fields by discovery.
    • Here is the second page of the wizard with all its fields prefilled:
      PrefIlledFields.png

    • For any fields that do not prefill, click the ellipsis [...] button and browse to the installed location.
  6. Click Finish to close the wizard.

You can view and manage your installed Android SDKs by opening the SDK Manager.

    Installing the USB Driver for Your Android Device (Required)

Instructions and download sites are available for various Android devices here:

For example, for a Nexus 7 or Nexus 10 tablet, you install the Google USB Driver using the Android SDK Manager, as follows:

  1. Start the SDK Manager.exe by selecting Start | All Programs | Embarcadero RAD Studio | Android SDKs | Android Tools:
    StartAndTools4.png
    Tip: If the Android SDK Manager does not start, run android.bat from the \tools directory inside your installed SDK directory.
  2. In the Android SDK Manager, install the USB driver for your Nexus 7 or Nexus 10 :
    Select Google USB Driver, clear all other checkboxes, and click Install 1 Package:
InstallUSBdriver.png
  1. Power up your Android device and connect it by USB cable to your development system.
  2. In the Control Panel Device Manager on your development system, right-click your Nexus 7 or Nexus 10, and select Update Driver Software.
  3. In the Update Driver Software dialog box, browse to the \extras folder in your Android SDK directory, and select the folder that matches your Nexus 7 or Nexus 10. (Select google for the Nexus 7 or Nexus 10.)
  4. Click OK.

    Creating an Android Emulator (Optional)

If you install the SDK and NDK during the RAD Studio installation, an Android emulator is created for you, so you do not need to create an emulator yourself.

An Android emulator enables you to run an Android application on your development system instead of on a live Android device. An emulator can be useful during development cycles, but typically has significant performance problems not seen on live Android devices.

For steps to follow in creating and running an emulator, see Creating an Android Emulator.

    See Also

Server Response from: ETNASC04