App crashes when barcode manager is initialized

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