How to reference Symbol EMDK while targeting Lollipop or Higher

Is there a way of using the symbol EMDK libraries while compiling the Android project with API 23 ?

 

I have a working sample with EMDK scanning with a build.gradle file that reads like this:

android {

  compileSdkVersion 'Symbol Technologies, Inc.:EMDK 3.1 (API 16):16'
   buildToolsVersion "23.0.1"

 

When compiling with the Symbol EMDK 3.1 API16 it works fine.

 

In my case, I target not only Enterprise units, so I am always compiling with the latest Sdk available.

So I am trying to change the sdk to 23 and add the com.symbol.emdk.jar as a dependency of the project but my app fail to run.

compileSdkVersion 23
buildToolsVersion "23.0.1"

 

Is there a way to add a reference to the EMDK and still target the latest SDK ?

Josh Fischer
Ok, I will look into this. 

Ok, I will look into this.  Thank you for the quick replies on my questions.  Fantastic service!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Josh Fischer
Guess I should also mention

Guess I should also mention some terminal output that I see.

DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.somecompany.shelfman"

  pkg: /data/local/tmp/com.somecompany.shelfman

Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
Hi Javier,at this moment the

Hi Javier,

at this moment the EMDK is supported only on API Level 16 or 19, however you can compile it with the latest SDK manually changing the app.gradle file,

to use the SDK you like:

compileSdkVersion 23
buildToolsVersion "23.0.1"


The key point is to include the com.symbol.emdk.jar library (that you need to copy in your libs folder from the EMDK setup folder) as a provided lib, not to be compiled in your project

dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'], exclude: ['com.symbol.emdk.jar'])

  compile 'com.android.support:appcompat-v7:23.0.1'
   provided fileTree(dir: 'libs', include: ['com.symbol.emdk.jar'])

}

~Pietro

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Javier Hernandez
Copy, pasted and like Ace

Copy, pasted and like Ace Ventura says "Like a glove"

My app is loading, now I need to write make the full implementation, should not take too long and out to production in no time.

Thanks a lot.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
If you don't have an MDM

If you don't have an MDM handy (Mobile Device Management, like SOTI or AirWatch) your best option is probably StageNow:

This is Zebra's new staging tool.

For the TC70 you need a first step that use the Rapid Deployment client on the device to install the StageNow Client, then you can use the client to install the EMDK runtime (and do other configurations) using stagenow.

If you have question about Stagenow is better you ask question on the product discussion list.

Ciao

~Pietro

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Josh Fischer
You are the man, it worked. 

You are the man, it worked.  Last question.  I have about 100 of these devices to program. Is there a way to automate the updating of each device or am I going to have to do this by hand?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
Hi Josh,I think that you're

Hi Josh,

I think that you're missing the EMDK Runtime on your TC70!

Take a look at this documentation: Configuring A Device

The first OS version released on the TC70 was missing the EMDK Runtime (Android v4.4.2). We released last month an updated OS (based on Android v4.4.3) that include the EMDK Runtime.

However is always better to be sure to install the latest available EMDK Runtime on the device when you want to use an application based on our EMDK. Follow the link I posted in this message and let us know if this solve your issue.

Best,

~Pietro

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
Hi Josh,do you've a reference

Hi Josh,

do you've a reference to the EMDK library and the EMDK permission listed in the Manifest.xml?

<uses-permission android:name="com.symbol.emdk.permission.EMDK" />  

<uses-library android:name="com.symbol.emdk" />

As explained in the EMDK documentation.

Or you can give a look at this post and the linked sample app:

Building Zebra's EMDK project using SDK Platform 23 - Tales from an old nibble

Ciao

~Pietro

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Josh Fischer
Hi Pietro,I copied the com

Hi Pietro,

I copied the com.symbol.emdk.jar into the libs folder.  I am trying to build a simple application using this library (actually the advanced scanner tutorial).  Everything is fine with the application until I try to reference any part of the EMDK library.  The stack trace that prints on the Activity load is below...

FATAL EXCEPTION: main

                                                                     Process: com.somecompany.shelfman, PID: 6909

                                                                     java.lang.NoClassDefFoundError: com.somecompany.shelfman.activities.ScannerActivity

                                                                         at com.somecompany.shelfman.activities.TaskSelectionActivity$1.onClick(TaskSelectionActivity.java:39)

                                                                         at android.view.View.performClick(View.java:4438)

                                                                         at android.view.View$PerformClick.run(View.java:18422)

                                                                         at android.os.Handler.handleCallback(Handler.java:733)

                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)

                                                                         at android.os.Looper.loop(Looper.java:136)

                                                                         at android.app.ActivityThread.main(ActivityThread.java:5050)

                                                                         at java.lang.reflect.Method.invokeNative(Native Method)

                                                                         at java.lang.reflect.Method.invoke(Method.java:515)

                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:780)

                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)

                                                                         at dalvik.system.NativeStart.main(Native Method)

----------------------------------------------------------------------------------------------------------------------------

The Activity referencing the EMDK libraries starts as

import com.symbol.emdk.EMDKManager;
import com.symbol.emdk.EMDKManager.EMDKListener;
import com.symbol.emdk.barcode.BarcodeManager;
import com.symbol.emdk.barcode.ScanDataCollection;
import com.symbol.emdk.barcode.Scanner;
import com.symbol.emdk.barcode.Scanner.DataListener;
import com.symbol.emdk.barcode.Scanner.StatusListener;
import com.symbol.emdk.barcode.ScannerInfo;
import com.symbol.emdk.barcode.StatusData;

import java.util.List;

public class ScannerActivity extends AppCompatActivity implements EMDKListener,
   StatusListener, DataListener, CompoundButton.OnCheckedChangeListener{

---------------------------------------------------------------------------------------------------------------------------

My build.gradle looks like....

apply plugin: 'com.android.application'
apply from: '../jacoco.gradle'

android {

  compileSdkVersion 23
   buildToolsVersion "23.0.1"

   defaultConfig {

   applicationId "com.somecompany.shelfman"
   minSdkVersion 19
   targetSdkVersion 23
   versionCode 1
   versionName "1.0"
   }

  buildTypes {

  release {

   minifyEnabled false
   proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
   }

  debug {

   testCoverageEnabled = true
   }

  }

}

dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'], exclude: ['com.symbol.emdk.jar'])

  testCompile 'junit:junit:4.12'
   testCompile 'org.mockito:mockito-core:1.+'
   testCompile 'org.robolectric:robolectric:3.0'
   testCompile 'org.hamcrest:hamcrest-core:1.2.1'
   compile 'com.android.support:appcompat-v7:23.0.1'
   compile 'com.android.support:design:23.1.1'
   provided fileTree(dir: 'libs', include: ['com.symbol.emdk.jar'])

}

-------------------------------------------------------------------------------------------------------------------------

If I take reference to the emdk library out the activity loads as I would expect. Any ideas?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
Good,"Like a glove!" :-)Can

Good,

"Like a glove!" :-)

Can you mark the question as answered?

thanks

~Pietro

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Josh Fischer
Sorry I forgot to mention the

Sorry I forgot to mention the manifest...

When I include <uses-library android:name="com.symbol.emdk" /> The application crashes when I try to deploy  it to my TC70.  Message states:

Application Installation Failed

Installation failed with message

INSTALL_FAILED_MISSING_SHARED_LIBRARY

Then some other lines of text mentioning uninstalling an existing version of the application, however, there is no previous version installed.  If I comment the <uses-library> line out the application still compiles until I load the Activity referencing the emdk library.  I should also note that I also have pasted the <uses-permission> tag as well.  See manifest below:

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.somecompany.shelfman"
   xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-permission android:name="com.symbol.emdk.permission.EMDK" />


  <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

  <uses-library android:name="com.symbol.emdk"/>
  <activity
        android:name=".activities.LoginActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
  </activity>
  <activity
        android:name=".activities.SplashScreenActivity"
        android:label="@string/title_activity_splash_screen"
        android:screenOrientation="portrait"
        android:theme="@style/SplashTheme">
       <intent-filter android:label="@string/app_name">
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
       </intent-filter>
  </activity>
  <activity
       android:name=".activities.TaskSelectionActivity"
        android:label="@string/title_activity_task_selection"
        android:theme="@style/AppTheme.NoActionBar">
  </activity>
  <activity android:name=".activities.ScannerActivity"
        android:label="ScannerActivity"
        android:theme="@style/AppTheme.NoActionBar">
  </activity>
  </application>

</manifest>

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Topic locked