cordova-plugin-camera: After open the camera i get "Illegal Argument Exception".

Bug Report

openCamera() {
    const options: CameraOptions = {
      quality: 100,
      destinationType: this.camera.DestinationType.DATA_URL,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE
    };

    this.camera.getPicture(options).then((imageData) => {
      console.log(imageData);
    }, (err) => {
      console.log(err);
    });
  }

This is my code. It’s very simple, I tried on Android 9 and Android 10, Also i played with the different CameraOptions but always i get “Illegal Argument Exception”

Problem

What is expected to happen?

I have expected the camera open

What does actually happen?

Throw the error Illegal Argument Exception

Information

The followings are part of my package.json

"dependencies": {
    "@angular/common": "~9.1.6",
    "@angular/core": "~9.1.6",
    "@angular/forms": "~9.1.6",
    "@angular/platform-browser": "~9.1.6",
    "@angular/platform-browser-dynamic": "~9.1.6",
    "@angular/router": "~9.1.6",
    "@auth0/angular-jwt": "^5.0.1",
    "@capacitor/android": "^2.2.1",
    "@capacitor/core": "2.2.1",
    "@ionic-native/android-permissions": "^5.28.0",
    "@ionic-native/badge": "^5.27.0",
    "@ionic-native/base64": "^5.28.0",
    "@ionic-native/camera": "^5.29.0",
    "@ionic-native/core": "^5.0.7",
    "@ionic-native/device": "^5.27.0",
    "@ionic-native/diagnostic": "^5.27.0",
    "@ionic-native/downloader": "^5.28.0",
    "@ionic-native/file": "^5.27.0",
    "@ionic-native/file-chooser": "^5.27.0",
    "@ionic-native/file-opener": "^5.27.0",
    "@ionic-native/file-path": "^5.27.0",
    "@ionic-native/file-picker": "^5.27.0",
    "@ionic-native/file-transfer": "^5.27.0",
    "@ionic-native/image-picker": "^5.27.0",
    "@ionic-native/local-notifications": "^5.27.0",
    "@ionic-native/media": "^5.27.0",
    "@ionic-native/media-capture": "^5.27.0",
    "@ionic-native/push": "^5.27.0",
    "@ionic-native/social-sharing": "^5.27.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic-native/video-editor": "^5.28.0",
    "@ionic/angular": "^5.0.0",
    "aws-sdk": "^2.739.0",
    "com-badrit-base64": "^0.2.0",
    "cordova-plugin-android-permissions": "^1.0.2",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-camera": "^5.0.1",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-file-opener2": "^3.0.4",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-filechooser": "^1.2.0",
    "cordova-plugin-filepath": "^1.5.8",
    "cordova-plugin-filepicker": "^1.1.6",
    "cordova-plugin-local-notification": "^0.9.0-beta.2",
    "cordova-plugin-media": "^5.0.3",
    "cordova-plugin-media-capture": "^3.0.3",
    "cordova-plugin-telerik-imagepicker": "^2.3.3",
    "cordova-plugin-video-editor": "^1.1.3",
    "cordova-plugin-x-socialsharing": "^5.6.8",
    "cordova.plugins.diagnostic": "^6.0.2",
    "date-fns": "^2.15.0",
    "es6-promise-plugin": "^4.2.2",
    "google-libphonenumber": "^3.2.11",
    "integrator-cordova-plugin-downloader": "^1.1.0",
    "ionic2-calendar": "^0.6.6",
    "jetifier": "^1.6.6",
    "jssha": "^3.1.1",
    "ng2-currency-mask": "^9.0.2",
    "phonegap-plugin-multidex": "^1.0.0",
    "phonegap-plugin-push": "^2.3.0",
    "rxjs": "~6.5.1",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.5",
    "@angular/cli": "~9.1.5",
    "@angular/compiler": "~9.1.6",
    "@angular/compiler-cli": "~9.1.6",
    "@angular/language-service": "~9.1.6",
    "@capacitor/cli": "2.2.1",
    "@ionic/angular-toolkit": "^2.1.1",
    "@types/google-libphonenumber": "^7.4.19",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/jssha": "^2.0.0",
    "@types/node": "^12.12.54",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.8.3"
  },
  "description": "An Ionic project"
}

Environment, Platform, Device

I am running Ionic CLI 6.10.1 with Capacitor - Angular CLI 9.0.6

Version information

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@breautek

After add that still getting same error.