ReferenceError: cordova is not defined when ionic cordova run android --device -lcs

Is cordova supposed to be available when running on an Android device from the command line? Maybe I am missing something here.

My barcode scanner plugin works just fine when I deploy the APK to the device yet when I run
ionic cordova run android --device -lcs
I get ReferencError: cordova is not defined

i am getting something similar when i try to user base64 for encoding

ReferenceError: device is not defined
at Base64.encodeFile

ReferenceError: device is not defined while using Base64.encodeFile.
How you resolved this error

Yes i used another method entirely
Maybe this will help you

  async uploadFile(path,filename)
  {
    const buffer = await this.file.readAsArrayBuffer(path,filename);
    const fileBlob = new Blob([buffer], {type: 'image/jpg'});
    const randomId = Math.random().toString(36).substring(2,8);
    const uploadTask = this.angularStorage.upload(`files/${randomId}.jpg`,fileBlob)
    const ref = this.angularStorage.ref(`files/${randomId}.jpg`);
    uploadTask.percentageChanges().subscribe(changes =>{
      this.uploadProgress = changes;
    });
    uploadTask.then(res =>{
      const downLoadUrl = ref.getDownloadURL().subscribe((url_img) => {
      this.submitPostWithImg(url_img);
      });
     this.presentToast('Upload finished');
    });
  }
  

Where is the this.angularStorage.upload came from?