I have to use certain plugins in my Ionic 3 Application but it gives Cannot find name error. I imported
import { AndroidPermissions } from '@ionic-native/android-permissions';
and on on declaring in constructor (public androidPermissions: AndroidPermissions) , it gives an error ([ts] Cannot find name 'AndroidPermissions'.) .
On declaring the same plugin in app.module.ts and declaring in Provider, it gave the error
[ts]
Type 'AndroidPermissionsOriginal' is not assignable to type 'Provider'.
Type 'AndroidPermissionsOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactory [2322]
After reading forums, I imported the plugin with ngx.
import { AndroidPermissions } from '@ionic-native/android-permissions/ngx'
Error got resolved, but on invoking it throws the error
Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
at AndroidPermissions.requestPermissions (http://192.168.0.13:8100/build/vendor.js:69796:154)
at http://192.168.0.13:8100/build/main.js:138:32
at t.invoke (http://192.168.0.13:8100/build/polyfills.js:3:14976)
at Object.onInvoke (http://192.168.0.13:8100/build/vendor.js:5134:33)
at t.invoke (http://192.168.0.13:8100/build/polyfills.js:3:14916)
at r.run (http://192.168.0.13:8100/build/polyfills.js:3:10143)
at http://192.168.0.13:8100/build/polyfills.js:3:20242
at t.invokeTask (http://192.168.0.13:8100/build/polyfills.js:3:15660)
at Object.onInvokeTask (http://192.168.0.13:8100/build/vendor.js:5125:33)
at t.invokeTask (http://192.168.0.13:8100/build/polyfills.js:3:15581)
Similar error happened when using Network plugin and SMS plugin.
Then I upgraded to Ionic 4 and now the versions i have all frameworks are Ionic CLI 4.9.0, Angular CLI: 7.2.3, Node: 8.11.1, Angular: 7.2.2, typescript 3.1.6 and cordova 8.1.2.