Android SDK and Emulator
Building and testing Android applications in Volt MX Iris requires two primary resources: Android SDK and Gradle. Gradle is an advanced build toolkit that manages dependencies and allows a developer to define custom build logic. This section describes how to install and configure these resources.
Prerequisites that you need to download:
For any queries you may have about installing Android SDKs and Android Studio, see Android SDK and Platform FAQs.
To build and view applications on the Android platform, do the following:
- Download and install Android Studio
- Download and unzip the Android SDK and setup necessary support packages
- Configure Volt MX Iris to build for the Android platform
- Set the Android SDK Home Environment Variable
-
Manually Set the Android Environment Variables
(This is necessary only if the Android SDK was installed after installing Volt MX Iris) * Configure Device for USB debugging * Listing devices and viewing logs * Configure an Android emulator * Launch the app using Run on My Device or the Emulator Menu * Launch the App from the Post Successful build
Download and install Android Studio
You must install Android Studio for building and testing Android applications using Volt MX Iris. To download and install Android Studio, click Google Android Studio.
Download and unzip the Android SDK and support packages
Required SDKs and support packages can be optionally downloaded during the Android Studio installation process. If you have not downloaded the required SDKs during the Android Studio installation, you can download and install the Android Command line tools (stand-alone SDK tools) by doing the following:
To download and install the Android Command line tools and necessary support packages, do the following:
- Using a web browser, navigate to the Command Line Tools download section on the Android studio and SDK tools download site.
- Depending on the operating system of your computer, click the appropriate SDK tools package. After reviewing the terms and conditions of the Android SDK license agreement, if you agree to them, check the option indicating that you have read and agree to them, and then click the download button.
-
Once the zip file downloads, navigate to the downloaded zip file location and unzip it. Place the contents in a folder in your system.
Important: For Windows users, install the Android SDK to a folder with a path that has no spaces, for example:
C:\Android\android-sdk
The default installation path contains at least one space, which may result in the emulator not being accessible in Eclipse and, therefore, Volt MX Iris. -
Volt MX Iris Android project will download all required SDKs, support packages, and any project specific build library dependencies using the Gradle Auto Download mechanism during the Android native project build.
All required SDK, support packages, and dependent libraries are auto downloaded by Gradle build. 5. You can also download the missing artifacts using Android Studio.
Click Install missing platform(s) and sync project link in the message that appears.
Select the defaults through the Component Installer and wait until Finish is enabled.
Click the Install Build Tools 26.2 and sync project link in the message window.
Select the defaults through the Component Installer and wait until Finish is enabled.
Known Issues:
- When a download dependency is in progress, and the network disconnects in the middle, Android build may hang indefinitely. This is a known technical issue with Gradle. Refer https://github.com/gradle/gradle/issues/868 for more info. You may have to restart iris to build again.
- When an SDK component is partially downloaded or corrupted, the build fails. Delete the corrupted SDK component and then proceed with the build.
Configure Volt MX Iris to build for the Android platform
Now that you have installed the Android SDK, you need to configure Volt MX Iris to recognize the Android platform.
To configure Volt MX Iris to build for the Android platform, do the following:
- In Volt MX Iris, click the Window menu, and then click Preferences.
- In the left pane, double-click VoltMX Iris, and then click Build.
- If it hasn't done so already, at this point Volt MX Iris auto-detects the Android SDK and asks if you would like to use the path that it has discovered as the Android Home. If you wish to, click OK. If Volt MX Iris did not auto-detect the Android SDK, in the Android Home text box, enter the path to the Android SDK packages. To ensure you don't introduce errors into the path that you type, you may want to click the accompanying Browse button, navigate to the Android SDK's location, and then click OK.
- Click OK.
- Specify which Android SDK to use when building an app. To do so, on the Project menu, click Settings.
- In the Project Properties dialog box, click the Native tab. A row of secondary tabs displays. From this row, click Android.
- In the SDK Versions section of the tab, from the Minimum drop-down list, ensure you set the minimum SDK version.
- From the Target drop-down list, select the SDK version you would prefer to build for.
- Click Finish.
Set the Android SDK Home Environment Variable
The following procedure is for the Windows environment, for the Mac, run the following command:
export ANDROID_HOME=/<installation location>
To set the Android SDK home environment variable, do the following:
- Click Start.
- Right-click Computer, and then select Properties.
- Click Advanced system settings.
- On the Advanced tab, click Environment Variables.
- Under User variables, click New.
- For Variable name, type the following value:
ANDROID_HOME - For Variable value, type the path to the parent directory where your Android SDK is installed. For instance:
C:\Android\android-sdk - Click OK until you have closed all dialog boxes. Do not click Cancel.
- Restart your computer.
Manually Set the Android Environment Variables
Under some circumstances, you might have to add the Android SDK environment variables manually. This is most commonly necessary if you installed Volt MX Iris before installing the Android SDK. If you already had the Android SDK installed when you install Volt MX Iris, Volt MX Iris detects the presence of the Android SDK and adds the necessary environment variables automatically.
For more information, click the procedure you want.
Add Windows Android Environment Variables Manually
Add Mac Android Environment Variables Manually
Add Windows Android Environment Variables Manually
To manually set the Android environment variables for a Windows computer, do the following:
- Click Start.
- Right-click Computer, and then select Properties.
- Click Advanced system settings.
- On the Advanced tab, click Environment Variables.
- Under System Variables, double-click Path.
- Add to the Path variable the location of the
/bin
folder in your installation of the JDK. For example:C:\Java\jdk1.7.0_79\bin
- Add to the Path variable the locations of the
/emulators, / tools
, and/platform-tools
folders in your installation of the Android SDK. For example:
C:\Android\android-sdk\emulator; C:\Android\android-sdk\tools;C:\Android\android-sdk\platform-tools
- Click OK until you have closed all dialog boxes. Do not click Cancel.
- Restart your computer.
Add Mac Android Environment Variables Manually
To manually set the Android environment variables for a Mac computer, do the following:
- In the home directory, locate
.bash_profile
, and then open it. If you do not have the.bash_profile
file, create it. -
Add to the Path variable the locations of the
/emulators, /tools
, and/platform-tools
folders in your installation of the Android SDK. For example:
export PATH=/users/<userid>/android-sdk/emulator; /users/<userid>/android-sdk/tools; /users/<userid>/android-sdk/platform-tools:$PATH
-
Save the file and close it.
Enable USB debugging on your Android Device
On Android 4.1 and lower, the Developer options screen is available by default. On Android 4.2 and higher, do the following:
- Open the Settings app.
- Select System.
- Scroll to the bottom and select About phone.
- Scroll to the bottom and tap Build number 7 times.
- Return to the previous screen to find Developer options near the bottom.
- Scroll down and enable USB debugging.
List Devices and View Logs
To List the Android devices connected to the Windows 10 PC, do the following:
- Navigate to C:\Users\USERNAME\AppData\Local\Android\platform-tools.
- Open a command window.
- Run
adb devices -l
to list the Android devices connected to the Windows 10 PC.
To connect to an Android device on your Windows machine, do the following:
- Navigate to C:\Users\USERNAME\AppData\Local\Android\tools
- Run
monitor.bat
and click on the connected device.
Configure an Android Emulator
Google has stopped supporting the standalone AVD manager and SDK Manager GUI tools, with latest Android SDK tools. When using, latest Android SDK tools >= 25.3.0, support for launching AVD Manager GUI to create android emulators and SDK manager to download missing components are deprecated from Volt MX Iris V9 release. You must install Android Studio on your machine to get GUI to create and use Android emulators. Click here for more information.
Alternatively, you can use avdmanager command line utility to create the emulators. Refer https://developer.android.com/studio/command-line/avdmanager.html for avdmanager command usage.
When using older Android SDK tools( < 25.3.0), you still would be able to create and launch AVDs using AVD Manager and SDK Manager GUI Tools.
Launch the App Using Run on My Device or the Emulator Menu
- Open your application project in Volt MX Iris.
The application opens in the default view. - From the Build menu, select Build Native Local/Build and Publish Native.
The Build Native Local/Build and Publish Native window appears. -
From the Post Build Action drop-down list, select Run on my Device/Emulator.
A new category Configured Devices & Emulators appears.
The Configured Devices & Emulators window displays available devices and emulators. Mobile Emulators appear under the Mobile section, and Table Emulators appear below the Tablets section.4. Select the Emulator on which you want to test the app. 5. Click Build.
The application generates and automatically opens on the devices or the AVD’s that are selected before. A message Application launched successfully on the device appears. 6. Click OK.
There are two other options in this window that you can use.
- Refresh: If you connect your device to the system after selecting the post-build action, use the Refresh option to refresh the list of connected devices and Emulators.
- Clear History: Use the Clear History option to remove old entries of devices and emulators that are not available on the system.
Launch the App Post Successful Build
- Open your application project in Volt MX Iris.
The application opens in the default view. - From the main menu, navigate to Build, select Build Native Local.
The Build Native Local window appears. - From the Post Build Action drop-down list, select Generate Native App or Run on my Device/Emulator.
- From the Platforms and Channels section, choose the channels you want to build the app.
-
Click Build.
Once the build is complete, details of the generated binaries appear in the Build.If you select Run on my Device/Emulator under the Post Build Action tab, the application installs and runs on the selected emulator.
If you select Generate Native App under the Post Build Action tab, then Volt MX Iris builds the app, you should run the application manually. 6. Under the Build tab, you can see two sections: General and Mobile. Launch Emulators appear under the General, and Mobile platforms appear under Mobile. The mobile platform list appears based on your selection from the Build Native Local tab. This includes devices, emulators, and AVDs.
-
Click Run to launch the app on your AVD.
Limitations
- Volt MX Iris does not store the details of the emulators in the .devices file since they do not always have the same unique identifier.
Follow Gradle-related Changes for different Volt MX Iris Versions
This section describes the various Gradle-related changes pertaining to different versions of Volt MX Iris.