[DAEMON-12] androidlib v2

GitHub Issuen/a
TypeNew Feature
Resolution Date2017-11-13T13:07:05.000+0000
Affected Version/sn/a
Fix Version/sAppc Daemon 1.0.0
ReporterChris Barber
AssigneeChris Barber


androidlib (https://github.com/appcelerator/androidlib) was originally built for early Hyperloop prototypes, but lacked the robustness and features of the Android tooling in the Titanium SDK. The purpose of this ticket is to update androidlib with the logic from the Titanium SDK while maintaining API consistency with ioslib and windowslib and preserving the features at androidlib supports.

Detect installed Android environment

detect() must return the following Android installation information: * SDK information ** Path to the SDK ** Paths to each executable and .jar file listed above ** build-tools, platform-tools, and tools paths and versions ** Targets (SDKs, add-ons) * NDK information * Android home directory path * Emulators * Devices When detecting the Android environment, there are a number of options that detect() must accept and use to override the defaults. These include: * bypassCache (Boolean)- When true, re-detects Android environment (default: false) * sdkPath (String) - The path to an Android SDK * ndkPath (String) - The path to an Android NDK * androidHomePath (String) * executables (Object) - Key/value lookup of executable name (i.e. android, adb, dx, etc) to its path

Android SDK

While there could be many Android installations, we only care about a single installation. To find it, search the the following locations:

The sdkPath specified in the detect() opts argument

ANDROID_SDK_ROOT environment variable

ANDROID_SDK environment variable

The parent folder containing the android or android.bat executable

The parent folder containing the adb or adb.exe executable

Various common paths

* Windows: %SystemDrive%, %ProgramFiles%, %ProgramFiles(x86)%, %CommonProgramFiles%, ~ * OS X/Linux: /opt, /opt/local, /usr, /usr/local, ~ In order for a path to be deemed a valid Android installation, it must have the following: * build-tools/<version>/aapt / build-tools/<version>/aapt.exe * build-tools/<version>/aidl / build-tools/<version>/aidl.exe * build-tools/<version>/dx / build-tools/<version>/dx.bat * platform-tools/adb / platform-tools/adb.exe * platform-tools/lib/dx.jar * tools/android / tools/android.bat * tools/emulator / tools/emulator.exe * tools/mksdcard / tools/mksdcard.exe * tools/proguard/lib/proguard.jar * tools/source.properties * tools/zipalign / tools/zipalign

Detect installed Android targets (SDKs and Addons)

Required information: * id (String) Example: "android-23" * name (String) Example: "Android 6.0" * description (String) Example: "Android + Google APIs" * type (String}} Either "platform" or "add-on" * api-level (String}} Examples: "23", "N" * sdk (Number) Examples: 23, 24 * abis (Array) * skins (Array) * revision (Number) * path (String) * androidJar (String) Path to android.jar. Needed for aapt package. * aidl (String) Path to framework.aidl file. * based-on (Object) Used for add-ons and used to derive aidl since only platform has an aidl file * libraries (Object) Map of add-on libraries. Used for for detecting if SDK supports maps, but this is probably not needed, just nice to have.

Android NDK


Android Home Directory

Derived based on androidHomePath option, ANDROID_SDK_HOME environment variable, or ~/.android.


An array of emulators containing the following information: NOTE: Incomplete * type (String) Either "avd" or "genymotion" * name (String) For Android emulators, this value is returned from avd name when telnetting into the emulator. For Genymotion, we get this from VM name in VirtualBox using vboxmanage. * id (String) Same value as name. Devices do not have a name, but we need a common identifier for the target, hence id. * abi (String) * api-level Not possible to get with older versions of Genymotion, so just set to null for Genymotion. Android emulator specific: * device (String) * path (String) * skin (String) Genymotion specific: * guid (String)


An array of devices.

androidlib should NOT...

* Determine if any SDK is supported or not * Determine if any sort of "issues"


  1. Feon Sua Xin Miao 2016-03-28 PR: https://github.com/appcelerator/androidlib/pull/5

JSON Source