Test Blog

Robert Galvin -
5 MIN READ
2

Developing EMDK Apps With Android Studio1.0.x

Overview

The purpose of this document is to outline the steps needed to integrate the Symbol EMDK for Android into Android Studio, walk through the available methods in which you can add the EMDK library to your Android Studio project, and explain how to import the current Eclipse based EMDK sample projects into Android Studio.

The manual EMDK integration process is only temporary and will not be necessary after an installer for Android Studio has been completed.

Prerequisites

The following items must be installed before setting up Android Studio for EMDK development.

  • Java Development Kit (JDK) – (v7u45 64-bit) or newer
  • EMDK for Android v3.0 and v3.0 Update1
  • Android Studio 1.0.x
  • Android SDK Build-tools rev.21.1.x
  • Android API 16 & 19

Make a note of the name and location where you install “Android Studio” and “Android SDK” on your system, you will need to refer to the Android SDK directory later when integrating EMDK for Android.

Setting up Android Studio for EMDK for Android development

EMDK SDK add-on Integration

Perform the following steps to make the EMDK available to Android API levels 16 & 19

  1. Locate the EMDK for Android installation root directory (default: C:\Program Files (x86)\Symbol EMDK for Android)

  2. Locate the Android SDK installation directory previously noted (default: C:\Users\xxx\ AppData\Local\Android\sdk)

  3. Copy the SDK add-ons from EMDK to Android SDK as mentioned below:

    Source: “…\Symbol EMDK for Android\v3.0\Integrator\add-ons\*.\”

    Destination: “…\Android\sdk\add-ons”

  4. Launch Android Studio

  5. Go to Tools > Android > SDK Manager

Now the integrated EMDK add-ons should be appear in the SDK Manager:

img

EMDK Profile Manager Plug-in Integration

Perfom the following steps to integrate the EMDK Profile Manager into Android Studio’s Menu bar.

  1. Locate the Android Studio installation directory previously noted (default: C:\Program Files\Android\Android Studio)

  2. Download the “com.symbol.emdkplugin.zip” archive from https://developer.motorolasolutions.com/community/android/emdk/downloads

  3. Extract the archive.

  4. Copy the EMDK Wizard plugin into Android Studio as mentioned below:

    Source: com.symbol.emdkplugin”

    Destination: “…\Android Studio\plugins” (e.g.: “C:\Program Files\Android\Android Studio\plugins”)

  5. Exit & Launch Android Studio.

Now the EMDK menu should appear in the Android Studio menu bar.

img

EMDK for Android development with Android Studio

In order to enable EMDK development in your project, you must first add the EMDK library. The EMDK for Android library can be added to your project via one of the following three methods.

Specify the EMDK SDK add-on as the “Minimum SDK” in the New Android Studio Project wizard

Launch Android Studio

Select “Start a new Android Studio project” or File > New Project.

Enter “Application name” and “Company Domain”.

Click Next

Select EMDK SDK add-on (ex: “Symbol Technologies, Inc.: EMDK API (16)”) as the “Minimum SDK” under Phone and Tablet.

img

Complete the New project Wizard by Clicking Next > Next > Finish

Android Studio will display your project when Gradle build process is complete.

To verify that the EMDK has been added to your project, Go to File > Project Structure.

Click on app under Modules in the Project Structure Window’s left-pane.

Check the value of “Compile Sdk Version”. It should be the selected EMDK SDK add-on (see below)

Symbol Technologies, Inc.:EMDK 3.0 (API 16):16

Symbol Technologies, Inc.:EMDK 3.0 (API 19):19

img

Another method to verifiy EMDK project integration is via the build.gradle file.

Open build.gradle (Module: app) from the left-pane. The compileSdkVersion should be assigned to EMDK SDK add-on.

img

Your project is now ready for EMDK development (see EMDK Help for more information on creating an EMDK app).

Import EMDK lib JAR as a Module

Starting with a previously created Project with a minimum API level of 16 or 19

Go to File > Project Structure

Press the button marked with “+” at the top-left to add a new module.

Select “Phone and Tablet Application”.

Select “Import JAR or AAR Package” from the list More Modules.

Click Next

Click Browse button and locate the EMDK jar file (com.symbol.emdk.jar) from the SDK add-on folder and click OK

img

The new module will eventualy appear in the left-pane of the project structure window.

Click on app in left-pane and select the dependencies tab

img

Press the button marked with the “+” at top-right to add select “Module Dependency”.

img

Select “com.symbol.emdk” from the “Choose modules” dialog then Press OK.

The new dependency should be listed, now Press OK

img

Your project is now ready for EMDK development (see EMDK Help for more information on creating an EMDK app).

Add EMDK SDK add-on name as the “Compile Sdk Version” in Project Structure

Starting with a previously created Project with a minimum API level of 16 or 19.

Go to File > Project Structure

Select app in the left-pane and Properties tab.

Manually enter one of the following add-on names in the “Compile Sdk Version” depending on the API version (see below):

SDK add-on (API 16) name: Symbol Technologies, Inc.:EMDK 3.0 (API 16):16

SDK add-on (API-19) name: Symbol Technologies, Inc.:EMDK 3.0 (API 19):19

img

Click OK then Select Yes in the resulting dialog.

img

Your project is now ready for EMDK development (see EMDK Help for more information on creating an EMDK app).

Importing EMDK Samples into Android Studio

Starting at the Android Studio Welcome Screen, Select “Import Non-Android Studio project”

Locate the EMDK Samples path

For example:  “C:\Users\Public\Symbol EMDK for Android\v3.0\Samples\ADT”.

Select the preferred sample, and press OK.

img

Click Next and then Finish to complete the import wizard.

When Android Studio has completed the Gradle build, your sample project will be displayed.

From the Build menu, select Rebuild Project.

img

Connect a Symbol Android device via USB, and select Run from the Run menu.

img

profile

Robert Galvin

Please Register or Login to post a reply

Replies