TypeError: Object(…) is not a function at AndroidPermissions.requestPermission

I am trying to ask permission at run time. I am getting TypeError: Object(…) is not a function at AndroidPermissions.requestPermission as per ionic docs.

permissions I am requesting is

this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.READ_EXTERNAL_STORAGE, this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE]);

I am getting this error

TypeError: Object(...) is not a function
at AndroidPermissions.requestPermission (vendor.js:63232)
at HomePage.webpackJsonp.139.HomePage.getPermission (main.js:75)
at main.js:67
at t.invoke (polyfills.js:3)
at Object.onInvoke (vendor.js:5134)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (vendor.js:5125)

Any Idea what I will be doing wrong? Or what is the cause of this issue. My package.json file is this

{
  "name": "myApp",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/android-permissions": "^5.0.0-beta.14",
    "@ionic-native/core": "~4.18.0",
    "@ionic-native/diagnostic": "^5.1.0",
    "@ionic-native/http": "^5.0.0",
    "@ionic-native/splash-screen": "~4.18.0",
    "@ionic-native/sqlite": "^5.0.0",
    "@ionic-native/status-bar": "~4.18.0",
    "@ionic/storage": "2.2.0",
    "@types/cordova": "0.0.34",
    "cordova-android": "7.1.4",
    "cordova-pdf-generator": "2.0.7",
    "cordova-plugin-advanced-http": "2.0.4",
    "cordova-plugin-android-permissions": "1.0.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "6.0.1",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.3.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "2.6.0",
    "cordova.plugins.diagnostic": "4.0.11",
    "file-saver": "^2.0.0",
    "ionic-angular": "3.9.2",
    "ionic-img-viewer": "^2.9.0",
    "ionicons": "3.0.0",
    "rxjs": "^6.3.3",
    "rxjs-compat": "^6.3.3",
    "sw-toolbox": "3.6.0",
    "xlsx": "^0.14.1",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.2",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-pdf-generator": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-advanced-http": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-android-permissions": {},
      "cordova.plugins.diagnostic": {}
    },
    "platforms": [
      "android"
    ]
  }
}

Ohh…got it working…updated
@ionic-native/core”: “^5.1.0”,
@ionic-native/android-permissions”: “^5.1.0”,

I have the same issue, but when I had an update to “@ionic-native/core”: “^5.1.0”,
@ionic-native/android-permissions”: “^5.1.0”, it does not work for me.

Aligning major versions of all ionic-native things indeed solves the problem described in OP, so either you have a different problem or didn’t really do that completely.

Now I have “@ionic-native/android-permissions”: “^5.13.0”, “@ionic-native/contacts”: “^5.13.0”,
@ionic-native/core”: “^5.13.0”, in package.json and I received: “Uncaught TypeError: Object(…) is not a function
at index.js:189
at Object. (index.js:297)”

What else do I have to change in order to
pass android permission?

Do you have the trailing /ngx on your imports as documented here?

Yes. but I did a mistake, later I had the old version @ionic-native/android-permissions, right now I update “@ionic-native/android-permissions”: to 5.13.0 version and I received: “core.js:1449 ERROR Error: Uncaught (in promise): TypeError: Object(…) is not a function
TypeError: Object(…) is not a function
at AndroidPermissions.checkPermission (index.js:182)”
?