1 Reply Latest reply on Feb 11, 2018 6:50 PM by David Mohnke

    Problem using EMDK for Android getting ClassNotFoundException

    David Mohnke

      I'm using the latest release of the Android EMDK with Android Studio version 2.3. 

       

      I've imported the com.symbol.emdk.jar file and added it as a dependency to my project.

       

      I've added <uses-permission android:name="com.symbol.emdk.permission.EMDK"/> to my manifest.

       

      Then when I implement the EMDKListener on my main activity as follows:

       

      public class GLinkInstallActivity extends AppCompatActivity implements EMDKListener

       

      and then add the implemented methods, I get the ClassNotFoundException when I try to execute the application.  Removing the "implements EMDKListener" will fix the problem, but that defeats the purpose.

       

      My build.gradle file is as follows:

       

      apply plugin: 'com.android.application'

      android {

        compileSdkVersion 25
         buildToolsVersion "26.0.2"
         defaultConfig {

        applicationId "com.zebra.glinkinstall"
         minSdkVersion 19
         targetSdkVersion 23
         versionCode 1
         versionName "1.0"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
         }

        buildTypes {

        release {

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

        }

        productFlavors {

        }

      }

       

      dependencies {

        compile fileTree(include: ['*.jar'], dir: 'libs')

        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {

        exclude group: 'com.android.support', module: 'support-annotations'
         })

        compile 'com.android.support:appcompat-v7:25.3.1'
         compile 'com.android.support:support-v4:25.3.1'
         testCompile 'junit:junit:4.12'
         provided project(':com.symbol.emdk')

      }

       

       

      Any ideas as to what I'm missing?

        • Re: Problem using EMDK for Android getting ClassNotFoundException
          David Mohnke

          Solved my own problem.  Wish the EMDK group would document this in their help files.  In order to include com.symbol.emdk.jar into a project, you need to:

           

          1. Use "Import Module" to import the jar into your Android Studio Project.
          2. Modify the AndroidManifest.xml for your application to include the permission "<uses-permission android:name="com.symbol.emdk.permission.EMDK"".
          3. Modify the AndroidManifest.xml for your application to include the tag "<uses-library android:name="com.symbol.emdk"" inside the "application" tag before the activities are listed.

           

          I was missing the last step.

          1 of 1 people found this helpful