Zebra EMDK Setup

EMDK For Android 13.0

Overview

This document describes how to set up macOS and Windows computers running Android Studio to work with Zebra's EMDK for Android software development kit. Android Studio enables Java developers to easily create powerful line-of-business apps for Android. EMDK extends Android Studio with tools to interface with and configure Zebra Android devices and their scanners, ports and other peripherals needed for data acquisition or other enterprise application requirements.

Prerequisites

The following software is required to use EMDK for Android:

Windows

  • Windows 7, 8, 8.1, 10 (32- or 64-bit)
  • Android Studio 2.2 or later
  • A Java Development Kit (JDK)

macOS

  • macOS 10.10.5 Yosemite or later
  • Android Studio 2.2 or later
  • A Java Development Kit (JDK)

Targeting Android 11

IMPORTANT: Due to package visibility restrictions imposed by Android 11 (API 30), EMDK apps targeting A-11 (or later) must include the following <queries> element in their AndroidManifest.xml file:

  
  <queries>
     ...
     <package android:name="com.symbol.emdk.emdkservice" />
     ...
  </queries>

Apps targeting API 29 (or earlier) have no such restriction; no change to the <queries> element is required.


Enable EMDK SDK

IMPORTANT:
Please install Android Studio before proceeding.
• Be sure to read and understand the licensing agreement(s) of any selected JDK or SDK.

This section includes the minimum steps for enabling EMDK to build productivity apps targeting Zebra devices running Android. To add the capability to also configure device settings from a new or existing app, complete this section and the EMDK Plugin section.

To enable the EMDK SDK in Android Studio:

  1. a. In Android Studio, go to the app module in the Android project in which to use EMDK.
    b. Navigate to the build.gradle file:
    image Click to enlarge; ESC to exit.
    c. Add the following line to the dependencies section:

        
            dependencies {
            compileOnly 'com.symbol:emdk:x.x.x' //  e.g. ‘com.symbol:emdk:7.6.10’
                ...
            }
    
  2. From the menu bar, go to Android Studio > Preferences > Build, Execution, Deployment > Compiler.

  3. Check the "Sync project with Gradle..." box shown below: image Click to enlarge; ESC to exit.

  4. Enable Android permissions by modifying the application's Manifest.xml file:

     
     <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.symbol.basicscansample1">
     <uses-permission android:name="com.symbol.emdk.permission.EMDK" />
        <application>
     ...
        </application>
     </manifest>
    
  5. For apps targeting devices running Android 11 (API 30) or later, add the following line in the <queries> element of the app's Manifest.xml file:

     
     <queries>
        ...
       <package android:name="com.symbol.emdk.emdkservice" />
     </queries>
    
  6. Enable the EMDK library in the application node of the manifest: :::xml ...

EMDK APIs are now ready to use.


Build configuration updates might be required. See next section.


Build Configuration

The public repository for Zebra’s EMDK-for-Android API SDK binaries has changed from JFrog's JCenter to Maven.

This repo change might require updates to a project's build.gradle and/or other configuration files to resolve SDK dependencies. Developers can to continue to use JCenter as a read-only mirror for Java packages, but JCenter is deprecated, and will no longer accept new packages or updated versions. Changes for all possible build scenarios are detailed below, and are divided according to EMDK-A version 9.1.1 and later, and versions prior to v9.1.1.

To help provide a seamless transition, EMDK for Android 9.1.1 binaries are currently available in both JCenter and Maven repos. The new mavenCentral() entry should allow EMDK to resolve dependencies for older releases successfully without any further change in the build.gradle file.


EMDK-A 9.1.1 and Older

Apps Already Compiled

If the Gradle plugin hasn't been updated in the SDK, the recent repo changes will have no affect on binaries already compiled with older EMDK releases and deployed to devices.


Compiling With Older Gradle

Apps compiling with Gradle versions prior to v7.0 should be able to continue to resolve EMDK dependencies successfully without any change to the JCenter repo reference, and there should be no deprecation warnings during compilation.

Zebra recommends adopting the latest options as soon as possible to avoid possible build and/or SDK dependency issues in the future.

  repositories {
      google()
      jcenter()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:3.1.2'
  }
  dependencies {
      compileOnly 'com.symbol:emdk:9.1.1'
  }

Note that EMDK for Android 9.1.1 was the last version to be available on JCenter.


Compiling With Latest Gradle

Gradle plugin v7.0 (or later) is now included with Android Studio and is configured as the default Gradle plugin. The JCenter repo entry has been updated to work with the Maven repository. Therefore, the build.gradle files of new and existing apps must be set as below:

  repositories {
      google()
      mavenCentral() /* <- formerly "jcenter()"
  }

  dependencies {
      classpath "com.android.tools.build:gradle:7.0.3"
  }

  dependencies {
      compileOnly 'com.symbol:emdk:9.1.1'
  }

If the new version of Gradle is present, the build.gradle file should appear as in the image below, with the mavenCentral() reference added and the jcenter() reference struck out. The jcenter() should be deleted.

image Click image to enlarge; ESC to exit.


EMDK-A 9.1.1 and Newer

If an app is not compiling successfully, try modifying the build.gradle file to point to the Maven URL (see below). Zebra recommends adopting the latest options as soon as possible to avoid possible build and SDK dependency issues in the future.

To help provide a seamless transition, EMDK for Android 9.1.1 binaries are currently available in both JCenter and Maven repos. The new Maven entry should allow EMDK to resolve dependencies for older releases successfully without any further change in the build.gradle file.

  dependencies {
      compileOnly 'com.symbol:emdk:9.1.1'
  }

Compiling With Older Gradle

To resolve the EMDK dependencies, projects with older Gradle plugins require the Maven reference to be added in the repositories section of the project build.gradle file.

Repo reference for EMDK releases prior to 9.1.1:
  repositories {
      jcenter()
  }
Repo reference for EMDK 9.1.1 and later:
  repositories {
      maven {
          url = "https://zebratech.jfrog.io/artifactory/EMDK-Android/"
      }
  }

Compiling With Latest Gradle

Projects configured with the latest Gradle plugins (such as 7.0.3) require the Maven reference to be added under dependencyResolutionManagement block in the settings.gradle file to resolve the EMDK dependency for new releases:

  dependencyResolutionManagement {
      repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
      repositories {
          google()
          mavenCentral()
          jcenter() // Warning: this repository is deprecated; no updates allowed
          maven {
              url = "https://zebratech.jfrog.io/artifactory/EMDK-Android/"
          }
      }
  }

Notes:

  • In the build.gradle, a plus sign ("+") can be substituted for a major or minor version number in the dependencies section. For example, declaring com.symbol:emdk:7.6+ uses SDK versions 7.6 and newer.
  • The Java version used to compile a project is based on the compileSdkVersion selected for the project. Different versions of Android support different versions of Java. If necessary, the default Java version can be overridden. Learn more.

Install/Update EMDK Plugin

The optional EMDK Plugin adds Profile Manager, a graphical UI for accessing the Zebra MX device-configuration layer built into every Zebra device. Zebra strongly recommends using the EMDK Plugin if the app is intended to configure the settings of a Zebra device.

Dialog boxes of Android Studio might vary slightly between versions for macOS and Windows.

To set up the EMDK Plugin:

  1. Uninstall prior EMDK installations and related files, if any.
  2. Select a Project SDK:
    a. Open an Android Studio project (if not already open).
    b. Select File -> Project Structure.
    c. In the left-hand pane under Project Settings, select "Project" (if not already selected).
    d. In the right-hand pane under "Project SDK," select an SDK from the drop-down or add or download one, as in the image below.
    NOTE: The Android development community recommends using the latest OpenJDK.
    image Click to enlarge; ESC to exit.
    e. Click "Apply" and then "OK" to close.
  3. Install the EMDK for Android plugin:
    a. Go to Android Studio -> Preferences.
    b. In the left-hand pane, select "Plugins" to show Installed Plugins and the Plugin Marketplace: image Click to enlarge; ESC to exit.
    c. Click "Marketplace" (if necessary) to show available Plugins.
    d. Enter "emdk" in the search box and hit ENTER.
    e. Click "Install" button.
    image Click to enlarge; ESC to exit.
    f. Click "Apply" to activate the Plugin, then Click "OK" to close.
    image Click to enlarge; ESC to exit.

The EMDK Plugin adds an "EMDK" menu in the Android Studio menu bar: image Click to enlarge; ESC to exit.

The EMDK Plugin is now ready to use.

Android Studio Jellyfish

For those that have updated to Android Studio 2023.3.1 (Jellyfish) and cannot see the EMDK menu by default, follow the steps below to display it.

To display the EMDK menu manually:

  1. While inside of a Project, click the magnifiying glass in the upper-right corner.
  2. Enter "EMDK" in the "Search Everywhere" box.
  3. Select EMDK from the results list that appears.
The EMDK "floating menu" should now be visible, similar to the image below:

image Click to enlarge; ESC to exit.


Uninstall EMDK

Windows

  1. Close Android Studio, if open.
  2. From Windows -> All Programs -> EMDK for Android [vX.X], select "Uninstall."
  3. Follow prompts to complete the uninstallation.

Mac OS

Note: This process references folders that are hidden by default. To unhide, see section below.

In the macOS Finder:

  1. Remove SDK add-ons:
    • Navigate to the /Users/[userName]/Library/Android/sdk/add-ons directory.
    • Remove all addon-symbol_emdk-symbol-XX folders, if present.
  2. Remove Wizard Core:
    • Navigate to the /Users/Shared directory.
    • Remove the "EMDK for Android" folder, if present.
  3. Remove Wizard plugin:
    • Open Applications folder.
    • Locate and right-click Android Studio app.
    • Select "Show Package Contents" from the menu.
    • Navigate to Contents -> plugins directory.
    • Remove com.symbol.emdk.wizard.intellijIdea folder, if present.

To unhide Mac OS folders:

  1. Open Terminal app (in Finder -> Applications -> Utilities).

  2. Paste the following into Terminal window (and hit RETURN):

    :::term defaults write com.apple.finder AppleShowAllFiles YES

  3. Right-click on the Finder icon (in the Dock) while holding the "Option/alt" key.

  4. Select "Relaunch" from the menu to make hidden files visible.

  5. To reverse, replace "YES" with "NO" in the Terminal command and repeat Step 3.