How to build and install an SDK for Android

Revision as of 09:45, 9 August 2019 by Registered User



1. Article purpose[edit source]

This article is intended for distribution-creator profile end users (see Which Package better suits your needs for more information).

When you add new APIs to the Android framework you must generate your own Android SDK, which is used by Android Studio to build your application.

This Android SDK is dedicated to the ST Android distribution version that you are using, and can be generated for Linux and/or Windows environments.

For information about Android API Levels, see the dedicated Android SDK page[1].

2. Prerequisites[edit source]




The environment used must have been installed using the right distribution creator Package for your selected microprocessor device. See the list of Android distribution Packages here.

3. Build SDK for distribution[edit source]

3.1. Set environment[edit source]

The Android SDK has to be generated in the eng build environment, so you must select the right case using the lunch command.

3.2. SDK for Linux[edit source]

Execute the following build command to generate the SDK

 make update-api
 make sdk

The result is in path out/host/linux-x86/sdk/<BoardId>/android-sdk_eng.<login>_<linux-x86>/platforms/android-<Version>/android.jar.

3.3. SDK for Windows[edit source]

A specific Ubuntu package needs to be installed for Windows Android SDK building, to add the unix2dos command:

 sudo apt-get install tofrodos

Execute the following build command to generate the SDK:

 make update-api
 make win_sdk

The result is in path out/host/windows/sdk/<BoardId>/android-sdk_eng.<login>_<windows>/platforms/android-<Version>/android.jar.

Info white.png Information
both Linux and Windows SDKs are generated when win_sdk is used.

4. Install SDK in Android Studio[edit source]

The information below applies to both Linux Ubuntu and Windows environments. (It is assumed that Android Studio is already installed.)

  • Open Android Studio
  • Open the Settings item in the File Menu
  • In Appearance & Behavior --> System Settings --> Android SDK
    • Check the path of the SDK as highlighted in Red in the picture below.
    • Check for the current SDK API selected, as highlighted in Template:DarkBlue in the picture below.

Android SDK.png

  • Copy the android.jar file provided with the developper package or the one you generate with the distribution to the Android Studio SDK path : <YourAndroidStudio_SDKPath>/platforms/android-<APILevel>/
  • Restart Android Studio
  • To check for new API availability in Android Studio, you can search for new Class/Symbol through the Navigate menu.

5. References[edit source]


Template:Maintener