15 Replies Latest reply on Oct 22, 2018 8:59 AM by Darryn Campbell

    App crashes when barcode manager is initialized

    Anbu Selvan John Bosco

      Dear ,

                  I have the following MainActivity class and the app crashes as soon as i call the initializescanner method.All i wanted to do is start the scanner as soon as the app starts.

       

      public class MainActivity implements EMDKListener  {

      private BarcodeManager barcodeManager = null;
         private Scanner scanner = null;

         private EMDKManager emdkManager = null;

       

      @Override
      protected void onCreate(Bundle savedInstanceState) {

         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);

             EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this);
              if (results.statusCode != EMDKResults.STATUS_CODE.SUCCESS) {

              //Failed to request the EMDKManager
          }

      }

      @Override
         public void onOpened(EMDKManager emdkManager) {

         this.emdkManager = emdkManager;

         try {

         // Call this method to enable Scanner and its listeners
         initializeScanner();
         } catch (ScannerException e) {

        e.printStackTrace();
         }

       

      //The EMDK Manager is ready and now you can call other EMDK APIs.
         }

       

      private void initializeScanner() throws ScannerException {

         if (scanner == null) {

         barcodeManager = (BarcodeManager) this.emdkManager                              // the app crashes here
         .getInstance(EMDKManager.FEATURE_TYPE.BARCODE);


         scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT);
         scanner.triggerType = Scanner.TriggerType.HARD;
         scanner.enable();
         scanner.read();
         }

        }

       

         @Override
         public void onClosed() {

         /* EMDKManager is closed abruptly. Call EmdkManager.release() to free the resources used by the current EMDK instance. */
         if (emdkManager != null) {

         emdkManager.release();
         emdkManager = null;
         }

        }

       

         @Override
         public void onDestroy(){

         super.onDestroy();
         if (emdkManager != null) {

         emdkManager.release();
         emdkManager = null;
         }

         }

      }

       

      Error

       

      Capture.PNG

          • Re: App crashes when barcode manager is initialized
            Anbu Selvan John Bosco

            Hi Darryn,

                           Thanks for the quick response.Yes i tried those barcode sample api.And then i moved on to create new project to use the same code that is used in sample barcode api.

            The device which i run is TC70 device.

              • Re: App crashes when barcode manager is initialized
                Darryn Campbell

                So the existing sample works... what error do you get at the line which crashes?  Anything in LogCat?  Is it throwing an exception?

                  • Re: App crashes when barcode manager is initialized
                    Anbu Selvan John Bosco

                    Hi Darryn,

                               The error happens when i try to initialize the barcode manager,

                     

                      BarCodeManager barcodeManager = (BarcodeManager) this.emdkManager                              // the app crashes here
                       .getInstance(EMDKManager.FEATURE_TYPE.BARCODE);

                      • Re: App crashes when barcode manager is initialized
                        Anbu Selvan John Bosco

                        jrq768:

                                      I tried to follow the same steps in the tutorial and built the app.But it crashes without opening please find the stack trace below please help me on this :-

                         

                        I/ExtensionEventCollectionService( 1606): handleInitializeExtension

                        D/ScannerPlugin( 1227): Set scanner parameters on SCAN_STATUS_ENABLED

                        D/IMG_FRM ( 1227): readsubmit for object: com.symbol.scanning.Scanner@3531f3a1, mdec: com.symbol.datawedge.plugins.ScannerPlugin$5@2e05f9c6

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = aim_mode , sValue = on

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = charset_name , sValue = UTF-8

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = code_id_type , sValue = 0

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = decoder_code128 , sValue = true

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = illumination_brightness , sValue = 10

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = illumination_mode , sValue = torch

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = image_capture_modes , sValue = 0

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = imager_mode , sValue = Barcode

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = lcd_mode , sValue = 0

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = low_power_timeout , sValue = 250

                        I/ScannerFramework(  185): [UndecodedImagerHandler::SetParameter] sKey = picklist , sValue = 0

                        E/ScannerFramework(  185): [UserContextManager::GetUserContext] Context not found in valid contexts for pid:10928

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,230.88KB of 8,192.00KB (4,961.12KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.16MB of 8.00MB (4.84MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,237.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,231.01KB of 8,192.00KB (4,960.99KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.16MB of 8.00MB (4.84MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,228.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,241.13KB of 8,192.00KB (4,950.87KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.17MB of 8.00MB (4.83MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,220.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,241.26KB of 8,192.00KB (4,950.74KB free)

                        D/ScannerPlugin( 1227): Scan read submitted.

                        D/ScannerPlugin( 1227): New Scanner status SCAN_STATUS_ENABLED

                        D/ScannerPlugin( 1227): Scan status changed from SCAN_STATUS_ENABLED to SCAN_STATUS_WAITFORTRIGGER

                        D/Client  ( 1227): requested to send: 110 (ScannerStateChanged): SCAN_STATUS_WAITFORTRIGGER

                        D/Client  ( 1227): sent: 110 (ScannerStateChanged): SCAN_STATUS_WAITFORTRIGGER

                        D/ScannerStateChanged( 1227): deserialize: state: SCAN_STATUS_WAITFORTRIGGER

                        D/ScannerPlugin( 1227): Status:WAITING;ProfileName:Launcher

                        D/Protocol( 1227): parsed 110 (ScannerStateChanged): SCAN_STATUS_WAITFORTRIGGER

                        D/SwipeAssistService( 1227): handleMessage(110 (ScannerStateChanged): SCAN_STATUS_WAITFORTRIGGER), connected clients: 1

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.17MB of 8.00MB (4.83MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,212.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,241.38KB of 8,192.00KB (4,950.62KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.17MB of 8.00MB (4.83MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,204.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/ScannerPlugin( 1227): New Scanner status SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,241.51KB of 8,192.00KB (4,950.49KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.17MB of 8.00MB (4.83MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,196.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,251.63KB of 8,192.00KB (4,940.37KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.18MB of 8.00MB (4.82MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,188.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,251.76KB of 8,192.00KB (4,940.24KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.18MB of 8.00MB (4.82MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,179.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,251.88KB of 8,192.00KB (4,940.12KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.18MB of 8.00MB (4.82MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,171.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,252.01KB of 8,192.00KB (4,939.99KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.18MB of 8.00MB (4.82MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,163.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        I/ExtensionApi( 1606): initializeEvents

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,262.13KB of 8,192.00KB (4,929.87KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.19MB of 8.00MB (4.81MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,155.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,262.26KB of 8,192.00KB (4,929.74KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.19MB of 8.00MB (4.81MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,147.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,262.38KB of 8,192.00KB (4,929.62KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.19MB of 8.00MB (4.81MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,139.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...STATUS: SCAN_STATUS_WAITFORTRIGGER

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug. =========SVC SS MANAGER======== PID: 10928

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3,262.51KB of 8,192.00KB (4,929.49KB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.heap native: allocated 3.19MB of 8.00MB (4.81MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5.00MB of 96.00MB (1.00MB free)

                        D/tag     (10928): com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback_HL > debug.memory: allocated: 5,663.00KB of 98,304.00KB (1,130.00KB free)

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): mScanner.sfScannerObj is null

                        D/com.symbol.emdk.emdkservice.barcode.SvcScanEventCallback(10928): onScanEvent...Triggering: IDLE

                • Re: App crashes when barcode manager is initialized
                  Anbu Selvan John Bosco

                  Could it be the problem of not configuring the Device Runtime Deployment.I am using a TC70 device with Android 5.0 version how to configure the runtime deployment for this.

                  • Re: App crashes when barcode manager is initialized
                    Anbu Selvan John Bosco

                    Thanks so much for the continuous support one last think i am not able to find any links  for downloading EMDK 6.0  download and after that what will be the steps to run Device Runtime Deployment as the link in zebra docs on Configure Device for Android was not clear. this is the link i refered

                    http://techdocs.zebra.com/emdk-for-android/6-0/guide/setupDevice/

                      • Re: App crashes when barcode manager is initialized
                        Darryn Campbell

                        Dan makes a good point in the other thread that this update is only required on KK, not 5.0.  Can you provide your app that does not work here?  As a zip.  I suspect it is an app issue since you say the sample apps worked fine on your device.

                          • Re: App crashes when barcode manager is initialized
                            Anbu Selvan John Bosco

                            I can provide the App but i forgot to mention that even the sample bar-code tutorial in zebra also crashes for me and the carsh happens when i press hard button to scan so this is a generic problem for me.I have missed some configuration either with the deivce or with my laptop.

                             

                            I use Android 3.0 and configured the EMDK using this document http://http://techdocs.zebra.com/emdk-for-android/3-1/guide/setupAndroidStudio/

                             

                            I followed the below tutorial setp by step and everthing works fine but as soon as i press the hard scan button the app crashes, (the emdk library i configured and added as a module dependency to the project)

                             

                            Basic Scanning Tutorial using Barcode API - Zebra Technologies Techdocs

                            • Re: App crashes when barcode manager is initialized
                              Anbu Selvan John Bosco

                              Finally i was able to run the app without any crash.

                               

                              The changes i made was in build.gradle from this :-

                               

                              android {

                                 compileSdkVersion 25
                                 buildToolsVersion '26.0.2'

                                 defaultConfig {

                                applicationId "com.xxx"
                                 minSdkVersion 16
                                 targetSdkVersion 19
                                 versionCode 1
                                 versionName "1.0"
                                 ndk {

                                abiFilters "armeabi-v7a", "x86"
                                 }

                              }

                              To this worked for me :-

                               

                               

                               

                               

                              android { 

                              compileSdkVersion 'Zebra Technologies Corp:EMDK APIs:26'                          //changed to emdk compile version as temporary fix
                                 buildToolsVersion '26.0.2'

                                 defaultConfig {

                                applicationId "com.liscanner"
                                 minSdkVersion 16
                                 targetSdkVersion 19
                                 versionCode 1
                                 versionName "1.0"
                                 ndk {

                                abiFilters "armeabi-v7a", "x86"
                                 }

                              }

                               

                              So my question is why the previous one did not work i added the EMDK as module dependency so it should have worked.But now the problem is scanning is not happening properly.Can you please help i can attach my app if you require.

                              • Re: App crashes when barcode manager is initialized
                                Anbu Selvan John Bosco

                                Now the app works but scanning has some problem the onData overidden method of dataListener is never called.I have attached the MainActivity i think i have missed a small code for the sacnner to call onDataMethod kindly provide your suggestions.

                                 

                                import android.app.Activity;
                                import android.content.Intent;
                                import android.content.SharedPreferences;
                                import android.os.AsyncTask;
                                import android.os.Bundle;
                                import android.preference.PreferenceManager;
                                import android.support.annotation.NonNull;
                                import android.support.design.widget.NavigationView;
                                import android.support.v4.view.GravityCompat;
                                import android.support.v4.widget.DrawerLayout;
                                import android.support.v7.app.ActionBarDrawerToggle;
                                import android.support.v7.widget.Toolbar;
                                import android.view.MenuItem;
                                import android.view.SubMenu;
                                import android.widget.EditText;
                                import android.widget.TextView;

                                import com.facebook.react.ReactApplication;
                                import com.facebook.react.ReactInstanceManager;
                                import com.facebook.react.bridge.Arguments;
                                import com.facebook.react.bridge.ReactApplicationContext;
                                import com.facebook.react.bridge.WritableMap;
                                import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
                                import com.facebook.react.modules.core.DeviceEventManagerModule;
                                import com.liscanner.connector.MenuModule;
                                import com.liscanner.view.settings.SettingsActivity_test;
                                import com.reactlibrary.JSBundleManager;
                                import com.reactlibrary.JSBundleManagerActivity;
                                import com.reactlibrary.model.Connection;
                                import com.reactlibrary.util.FileUtil;
                                import com.reactlibrary.view.ListConnectionActivity;
                                import com.reactlibrary.view.NewConnectionActivity;

                                import java.io.FileNotFoundException;
                                import java.io.IOException;
                                import java.util.ArrayList;

                                import static com.reactlibrary.util.FileUtil.isFileExistInDevice;
                                import static com.reactlibrary.view.ListConnectionActivity.versionList;

                                import com.symbol.emdk.EMDKManager;
                                import com.symbol.emdk.EMDKManager.EMDKListener;
                                import com.symbol.emdk.EMDKResults;
                                import com.symbol.emdk.barcode.BarcodeManager;
                                import com.symbol.emdk.barcode.ScanDataCollection;
                                import com.symbol.emdk.barcode.Scanner;
                                import com.symbol.emdk.barcode.ScannerException;
                                import com.symbol.emdk.barcode.ScannerResults;

                                public class MainActivity extends AppCompatActivity, DefaultHardwareBackBtnHandler, NavigationView.OnNavigationItemSelectedListener{

                                 

                                 

                                   private HelloFragment mViewFragment;
                                   private ReactInstanceManager mReactInstanceManager;
                                   public static ArrayList<String> menuString = new ArrayList<>();
                                   ReactApplicationContext menuContext;

                                   private EMDKManager emdkManager = null;
                                   private BarcodeManager barcodeManager = null;
                                   private Scanner scanner = null;
                                   private TextView statusTextView = null;
                                   private EditText dataView = null;
                                   private EMDKWrapper emdkWrapper = null;

                                   public void setMenuContext(ReactApplicationContext menuContext) {

                                   this.menuContext = menuContext;
                                   }

                                 

                                   public ReactApplicationContext getMenuContext() {

                                   return menuContext;
                                   }

                                 

                                   @Override
                                   protected void onCreate(Bundle savedInstanceState) {

                                   super.onCreate(savedInstanceState);

                                   setContentView(R.layout.activity_main);
                                   Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                                   setSupportActionBar(toolbar);

                                   mReactInstanceManager =

                                  ((MainApplication) getApplication()).getReactNativeHost().getReactInstanceManager();


                                   mViewFragment = new HelloFragment();

                                   if (mViewFragment != null) {

                                   mViewFragment.setMainApplication((ReactApplication) getApplication());
                                   mViewFragment.setmReactInstanceManager(mReactInstanceManager);
                                   }

                                  getSupportFragmentManager().beginTransaction().add(R.id.container, mViewFragment).commit();

                                   if (android.os.Build.MANUFACTURER.contains("Zebra Technologies") || android.os.Build.MANUFACTURER.contains("Motorola Solutions")) {

                                   emdkWrapper  = new EMDKWrapper();
                                   EMDKResults results = emdkWrapper.getEMDKManager(savedInstanceState);
                                   if (results.statusCode != EMDKResults.STATUS_CODE.SUCCESS) {

                                   //Failed to request the EMDKManager
                                   }

                                  }

                                 

                                 

                                   DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
                                   ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(

                                   this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
                                   drawer.setDrawerListener(toggle);
                                   toggle.syncState();

                                   NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
                                   navigationView.setNavigationItemSelectedListener(this);
                                   }


                                   public class EMDKWrapper implements EMDKListener,Scanner.DataListener {

                                   EMDKManager emdkManager = null;
                                   // Declare a variable to store Barcode Manager object
                                   private BarcodeManager barcodeManager = null;
                                   int dataLength = 0;

                                   // Declare a variable to hold scanner device to scan
                                   private Scanner scanner = null;


                                   EMDKResults getEMDKManager(Bundle savedInstanceState) {

                                   EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this);
                                   return results;

                                // if (results.statusCode != EMDKResults.STATUS_CODE.SUCCESS) {
                                // //Failed to request the EMDKManager
                                // }
                                   }

                                 

                                 

                                   @Override
                                   public void onOpened(EMDKManager emdkManager) {

                                   this.emdkManager = emdkManager;
                                   try {

                                   // Call this method to enable Scanner and its listeners
                                   initializeScanner();
                                   } catch (ScannerException e) {

                                  e.printStackTrace();
                                   }

                                 

                                //The EMDK Manager is ready and now you can call other EMDK APIs.
                                   }

                                 

                                 

                                   @Override
                                   public void onClosed() {

                                   /* EMDKManager is closed abruptly. Call EmdkManager.release() to free the resources used by the current EMDK instance. */
                                   if (emdkManager != null) {

                                   emdkManager.release();
                                   emdkManager = null;
                                   }

                                  }

                                 

                                   private void initializeScanner() throws ScannerException {

                                   if (scanner == null) {

                                   // Get the Barcode Manager object
                                   barcodeManager = (BarcodeManager) this.emdkManager
                                   .getInstance(EMDKManager.FEATURE_TYPE.BARCODE);
                                   // Get default scanner defined on the device
                                   scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT);
                                   // Add data and status listeners
                                   scanner.addDataListener(this);
                                // scanner.addStatusListener(this);
                                   scanner.triggerType = Scanner.TriggerType.HARD;
                                   scanner.enable();
                                   scanner.read();
                                   }

                                  }

                                 

                                   @Override
                                   public void onData(ScanDataCollection scanDataCollection) {

                                   new AsyncDataUpdate().execute(scanDataCollection);                              //never comes here after scanning
                                   }

                                 

                                   private class AsyncDataUpdate extends
                                   AsyncTask<ScanDataCollection, Void, String> {

                                 

                                   @Override
                                   protected String doInBackground(ScanDataCollection... params) {

                                   String statusStr = "";

                                   try {

                                   scanner.read();

                                   ScanDataCollection scanDataCollection = params[0];

                                   // The ScanDataCollection object gives scanning result and the
                                  // collection of ScanData. So check the data and its status
                                   if (scanDataCollection != null
                                   && scanDataCollection.getResult() == ScannerResults.SUCCESS) {

                                 

                                   ArrayList<ScanDataCollection.ScanData> scanData = scanDataCollection
                                   .getScanData();

                                   // Iterate through scanned data and prepare the statusStr
                                   for (ScanDataCollection.ScanData data : scanData) {

                                   // Get the scanned data
                                   String barcodeData = data.getData();
                                   // Get the type of label being scanned
                                // LabelType labelType = data.getLabelType();
                                  // Concatenate barcode data and label type
                                   statusStr = barcodeData;
                                   }

                                  }

                                 

                                  } catch (ScannerException e) {

                                   // TODO Auto-generated catch block
                                   e.printStackTrace();
                                   }

                                 

                                   // Return result to populate on UI thread
                                   return statusStr;
                                   }

                                 

                                   @Override
                                   protected void onPostExecute(String result) {

                                   // Update the dataView EditText on UI thread with barcode data and
                                  // its label type
                                   if (dataLength++ > 50) {

                                   // Clear the cache after 50 scans
                                // dataView.getText().clear();
                                   dataLength = 0;
                                   }

                                // dataView.append(result + "\n");
                                   }

                                 

                                   @Override
                                   protected void onPreExecute() {

                                  }

                                 

                                   @Override
                                   protected void onProgressUpdate(Void... values) {

                                  }

                                  }

                                  }