Difference between revisions of "How to build and install an SDK for Android"

[unchecked revision] [quality revision]
m (SDK for Linux®)
m (SDK for Windows®)
 

This article explains how to integrate the custom Android™ SDK for Android Studio.

1 Prerequisites[edit]

One of the following environments must be installed:

Android Studio must be installed.

Information about Android API Levels is available in the Android SDK page[1].

For Developer Package users go directly to section Install SDK in Android Studio.

2 Build SDK for distribution[edit]

2.1 Set environment[edit]

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

2.2 SDK for Linux®[edit]

Execute the following build commands to generate the SDK

 make sdk

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

2.3 SDK for Windows®[edit]

For Windows®, a specific Ubuntu® package needs to be installed to build the Android™ SDK for Windows®, add the unix2dos command:

 sudo apt-get install tofrodos

Execute the following build commands 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.

3 Install SDK in Android Studio[edit]

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

  • Open Android Studio
  • Open Settings in the File Menu
  • In the Settings pop-up select Appearance & Behavior --> System Settings --> Android SDK
    • Check the path of the SDK as highlighted in Red in the picture below.
    • Check for the correct SDK API selected, as highlighted in Blue in the picture below.

Android SDK.png

  • Copy the android.jar file provided with the developer package or the custom version 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, search for new Class/Symbol through the Navigate menu.

4 References[edit]


This article explains how to integrate the custom Android&trade; SDK for Android Studio.

== Prerequisites ==
One of the following environments must be installed:
* [[Which_STM32MPU_Embedded_Software_Package_for_Android_better_suits_your_needs#Distribution_Package | Distribution Package]] to generate a custom SDK to Android Studio.
* [[Which_STM32MPU_Embedded_Software_Package_for_Android_better_suits_your_needs#Developer_Package | Developer Package]] to install an existing SDK to Android Studio.

Android Studio must be installed.

Information about Android API Levels is available in the Android SDK page<ref>https://developer.android.com/guide/topics/manifest/uses-sdk-element.html</ref>.

For Developer Package users go directly to section [[#Install_SDK_in_Android_Studio|Install SDK in Android Studio]].

== Build SDK for distribution ==
=== Set environment ===
The Android&trade; SDK has to be generated in the {{Highlight|''eng''}} build environment, select the right case when using the <code>lunch</code> command.

=== SDK for Linux<sup>®</sup> ===
Execute the following build commands to generate the SDK
 {{PC$}} make sdk
The result is in the path <code>out/host/linux-x86/sdk/{{HighlightParam|''<BoardId>''}}/android-sdk_eng.{{HighlightParam|''<login>''}}_{{HighlightParam|''<linux-x86>''}}/platforms/android-{{HighlightParam|''<Version>''}}/android.jar</code>.

=== SDK for Windows<sup>®</sup> ===
For Windows<sup>®</sup>, a specific Ubuntu<sup>®</sup> package needs to be installed to build the Android&trade; SDK for Windows<sup>®</sup>, add the ''unix2dos'' command:
 {{PC$}} sudo apt-get install tofrodos

Execute the following build commands to generate the SDK:
 {{PC$}} make update-api
 {{PC$}} make win_sdk

The result is in path <code>out/host/windows/sdk/{{HighlightParam|''<BoardId>''}}/android-sdk_eng.{{HighlightParam|''<login>''}}_{{HighlightParam|''<windows>''}}/platforms/android-{{HighlightParam|''<Version>''}}/android.jar</code>.

{{ Info | Both Linux<sup>®</sup> and Windows<sup>®</sup> SDKs are generated when win_sdk is used. }}

== Install SDK in Android Studio ==
The information below applies to both Linux<sup>®</sup> Ubuntu<sup>®</sup> and Windows<sup>®</sup> environments. (It is assumed that Android Studio is already installed.)

* Open Android Studio
* Open Settings in the File Menu
* In the Settings pop-up select Appearance & Behavior --> System Settings --> Android SDK
** Check the path of the SDK as highlighted in {{red|'''Red'''}} in the picture below.
** Check for the correct SDK API selected, as highlighted in {{STDarkBlue|'''Blue'''}} in the picture below.

[[Image:Android SDK.png|800px|link=]]

* Copy the <code>android.jar</code> file provided with the developer package or the custom version with the distribution, to the Android Studio SDK path : <code>{{HighlightParam|''<YourAndroidStudio_SDKPath>''}}/platforms/android-{{HighlightParam|''<APILevel>''}}/</code>

* Restart Android Studio

* To check for new API availability in Android Studio, search for new Class/Symbol through the Navigate menu.

== References ==<references />

<noinclude>

[[Category:How to Android]]
[[Category:Android]]
{{PublicationRequestId |13261 | 2019-09-12}}</noinclude>
Line 26: Line 26:
   
 
Execute the following build commands to generate the SDK:
 
Execute the following build commands to generate the SDK:
{{PC$}} make update-api
 
 
  {{PC$}} make win_sdk
 
  {{PC$}} make win_sdk