12 Replies Latest reply on Jun 11, 2018 11:33 PM by Darryn Campbell

    App crashing when trying to add the EMDK as a dependency.

    Sandeep rathod

      I have setup the EMDK for Android Studio as "Importing EMDK lib Jar as a Module" by following the steps at the following url EMDK For Android Setup (Android Studio1.0.x) - Zebra Technologies Techdocs

      Build .gradle contains the following :

       

      compile project(':com.symbol.emdk')

       

      Crash reason :

      Check failed: called != nullptr int java.lang.Enum.ordinal() com.symbol.emdk.EMDKManager$FEATURE_TYPE[]

       

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

      When the gradle is changed to

       

      provided project(':com.symbol.emdk')

      It is unable to import com.symbol.emdk.barcode.Scanner;

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

      unable to import if the gradle is changed to

      dependencies {
      provided fileTree
      (include: ['com.symbol.emdk.jar'], dir: '/Users/<YOUR USERNAME>/Library/Android/sdk/add-ons/addon-symbol_emdk-symbol-19/libs')
      compile fileTree
      (exclude: ['com.symbol.emdk.jar'], dir: 'libs')

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

       

      jrq768@

        • Re: App crashing when trying to add the EMDK as a dependency.
          Sandeep rathod

          Appropriate Permissions and Library added in Manifest file

            • Re: App crashing when trying to add the EMDK as a dependency.
              Darryn Campbell

              Hi, those instructions are quite old... I suggest you add EMDK to your gradle build file as described at EMDK for Android Programming Practices - Zebra Technologies TechDocs

                • Re: App crashing when trying to add the EMDK as a dependency.
                  Sandeep rathod

                  Hi,

                  App is crashing, please find the attached crash log

                   

                   

                  E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/xxx/Activity/AcActivity;

                          at com.xxx.x.Adapter.CustomAdapter$1.onClick(CustomAdapter.java:341)

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

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

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

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

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

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

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

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

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

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

                       Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.x.Activity.AcActivity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.xxx.x-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

                          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

                          at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

                          at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

                          at com.xxx.x.Adapter.CustomAdapter$1.onClick(CustomAdapter.java:341)

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

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

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

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

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

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

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

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

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

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

                       Suppressed: java.lang.NoClassDefFoundError: com.xxx.x.Activity.AcActivity

                          at dalvik.system.DexFile.defineClassNative(Native Method)

                          at dalvik.system.DexFile.defineClass(DexFile.java:226)

                          at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)

                          at dalvik.system.DexPathList.findClass(DexPathList.java:321)

                          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)

                            ... 13 more

                       Suppressed: java.lang.ClassNotFoundException: com.xxxx.Activity.AcActivity

                          at java.lang.Class.classForName(Native Method)

                          at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

                          at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

                          at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

                            ... 12 more

                       Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

                   

                  -----

                  Build.gradle file

                  provided fileTree(include: ['com.symbol.emdk.jar'], dir: 'C:\\Users\\xxx\\AppData\\Local\\Android\\sdk\\add-ons\\addon-symbol_emdk-symbol-26\\libs')

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

                    • Re: App crashing when trying to add the EMDK as a dependency.
                      Darryn Campbell

                      Hi, that error indicates the system cannot find com.google.android.maps.jar.  Please note that if you are using a non-GMS device then maps will not be present - that could be the cause.

                        • Re: App crashing when trying to add the EMDK as a dependency.
                          Sandeep rathod

                          Now,Im getting crash on the following line

                           

                              Caused by: java.lang.ClassNotFoundException: Didn't find class "com.symbol.emdk.barcode.Scanner$DataListener" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.smartkargo.shipper-1/base.apk"],nativeLibraryDirectories=[/data/app/com.smartkargo.shipper-1/lib/x86, /system/lib, /vendor/lib]]

                          • Re: App crashing when trying to add the EMDK as a dependency.
                            Sandeep rathod

                            Similar error on another demo

                            06-11 11:49:34.453 15834-15834/? E/AndroidRuntime: FATAL EXCEPTION: main

                                Process: com.zebra.scannerlifecycle, PID: 15834

                                java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.zebra.scannerlifecycle/com.zebra.scannerlifecycle.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.zebra.scannerlifecycle.MainActivity" on path: DexPathList[[zip file "/data/app/com.zebra.scannerlifecycle-1/base.apk"],nativeLibraryDirectories=[/data/app/com.zebra.scannerlifecycle-1/lib/x86, /system/lib, /vendor/lib]]

                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)

                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)

                                    at android.app.ActivityThread.-wrap12(ActivityThread.java)

                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)

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

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

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

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

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

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

                                 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.zebra.scannerlifecycle.MainActivity" on path: DexPathList[[zip file "/data/app/com.zebra.scannerlifecycle-1/base.apk"],nativeLibraryDirectories=[/data/app/com.zebra.scannerlifecycle-1/lib/x86, /system/lib, /vendor/lib]]

                                    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)

                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

                                    at android.app.Instrumentation.newActivity(Instrumentation.java:1078)

                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)

                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)

                                    at android.app.ActivityThread.-wrap12(ActivityThread.java)

                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)

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

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

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

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

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

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

                                Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/symbol/emdk/barcode/Scanner$DataListener;

                                    at java.lang.VMClassLoader.findLoadedClass(Native Method)

                                    at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)

                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:362)

                                    ... 12 more

                                 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.symbol.emdk.barcode.Scanner$DataListener" on path: DexPathList[[zip file "/data/app/com.zebra.scannerlifecycle-1/base.apk"],nativeLibraryDirectories=[/data/app/com.zebra.scannerlifecycle-1/lib/x86, /system/lib, /vendor/lib]]

                                    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)

                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)