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)”
?

Right now I have “@ionic-native/android-permissions”: “^5.14.0”, “@ionic-native/contacts”: “^5.14.0”,
@ionic-native/core”: “^5.14.0”, in package.json and I received:
Typescript Error

Cannot find name ‘unknown’.

…cket/bettingods-app-ionic/node_modules/@ionic-native/core/decorators/common.d.ts

export declare function wrapPromise(pluginObj: any, methodName: string, args: any[], opts?: CordovaOptions): Promise;

I updated the typescript from version 2.6.2 to 3.6.3 in package.json and receive the same error:
Uncaught TypeError4"]
typescript
[/quote]

: Object(…) is not a function
at index.js:189
at Object. (index.js:297)
at webpack_require (bootstrap 6d021e35cb99fc8c8753:54)
at Object.381 (main.ts:5)
at webpack_require (bootstrap 6d021e35cb99fc8c8753:54)
at Object.376 (main.ts:1)
at webpack_require (bootstrap 6d021e35cb99fc8c8753:54)
at webpackJsonpCallback (bootstrap 6d021e35cb99fc8c8753:25)
at main.js:1

Can you help me?