Ionic-native 'plugin not installed' but 'ionic plugin add' says already installed

Hi,

I recently switched from ngCordova to ionic-native. Mainly for camera, statusbar and network. When using the network plugin it says:

[Warning] Native: tried calling e.connection, but the e plugin is not installed. (ionic.native.min.js, line 4) [Warning] Install the e plugin: 'ionic plugin add cordova-plugin-network-information' (ionic.native.min.js, line 4)

or statusbar, it says:

[Warning] Native: tried calling e.isVisible, but the e plugin is not installed. (ionic.native.min.js, line 4) [Warning] Install the e plugin: 'ionic plugin add cordova-plugin-statusbar' (ionic.native.min.js, line 4)

The camera plugin works without a warning.

Running ionic plugin add cordova-plugin-statusbar or ionic plugin add cordova-plugin-network-information this is the output:

$ ionic plugin add cordova-plugin-network-information Updated the hooks directory to have execute permissions Plugin "cordova-plugin-network-information" already installed on android. Plugin "cordova-plugin-network-information" already installed on ios. Saving plugin to package.json file

It’s worth to be noted, that I installed ionic-native via bower install ionic-native --save and not npm install ionic-native because the node_modules seems not to be deployed to the app and I could not link to ionic.native.min.js. And I’m still using ionic 1 but with typescript.

What could be the problem here?

$ ionic info
Your system information: Cordova CLI: 6.2.0 Gulp version: CLI version 3.9.1 Gulp local: Local version 3.9.1 Ionic Framework Version: 1.3.1 Ionic CLI Version: 1.7.16 Ionic App Lib Version: 0.7.3 ios-deploy version: 1.8.6 ios-sim version: 5.0.6 OS: Mac OS X El Capitan Node Version: v0.12.7 Xcode version: Xcode 7.3.1 Build version 7D1014

An example project:

https://github.com/Briends/ionic-with-ionic-native/tree/master

2 Likes

Relieved I’m not the only one. I’m seeing exactly the same behavior and opened up a thread shortly before you did. Hopefully someone from the Ionic team will be able to tell us what’s going wrong here. Great that you provided a GitHub repo with the error.

2 Likes

I filed an issue: https://github.com/driftyco/ionic-native/issues/438

1 Like

For me, this comment by github-user ihadeed solved the problem:

In what sequence did you list the JavaScript files in your index.html?

The correct order is:

  • cordova.js
  • ionic native
  • your app’s code

I solved it by putting cordova.js as the first import.

2 Likes

I guess this solution is obsolete with ionic native added by default in the latest RC of Ionic2. At least in my index.html there is no longer any javascript that loads ionic native. I can see a dependency to ionic-native in package.json though.

I am unable to get the cordova-plugin-nativeaudio to work though. I get the error “plugin_not_installed” from the Promise when I am trying to call the NativeAudio.preloadSimple().

I did use this command:

ionic plugin add cordova-plugin-nativeaudio --save

And that did add the plugin to the plugins folder as well as the config.xml. Also this seems to work fine:

import { NativeAudio } from 'ionic-native';

So it can access the NativeAudio object and I am able to call the preloadSimple function. But it fails with “plugin_not_installed” when running it on a device (Android).

3 Likes

I have the same problem on Android and iOS using the plugin InAppPurchase. I re installed it several times, deleting the www/, plugins/ and platforms/ folders, didn’t help.

Would be great to have a solution for that.

window.inAppPurchase is available but Ionic Native doesn’t recognize it.

I was able to solve the problem now. I was using the plugin in the constructor of a service and therefore had to wait for the Platform.ready() event. Hope that helps you too! :slight_smile:

3 Likes

how do you wait for Platform.ready() across/inside the components ?

can you show index.html file with correct order?

I have like this problem with camera plugin in ionic and i install cordova and native plugin

Yes, You must initialize the plugin after cordova is ready:

import {Component} from '@ angular / core';
import {Platform} from 'ionic-angular';


@Component ({...})
export MyApp {
   constructor (public plt: Platform) {
     this.plt.ready (). then ((readySource) => {
       // initialize plugin
     });
   }
}

I was frustrated with this issue for a couple hours… in my case, it seems to be an XCode issue.

  1. Close XCode
  2. ionic cordova build platform iOS
  3. re-open XCode
  4. Works!

Xcode 9.3

cli packages:

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 1.3.7
Cordova Platforms  : ios 4.5.4
Ionic Framework    : ionic-angular 3.4.2

System:

ios-deploy : 1.9.2
Node       : v8.4.0
npm        : 5.7.1
OS         : macOS High Sierra
Xcode      : Xcode 9.3 Build version 9E145

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro
1 Like

I also was frustrated with this issue, closing and reopening the xcode (by shutting down the system without reopen windows in Mac) worked for me… really really thanks dear

Hi, i have the same problem with firebase…testing it on Ionic DevApp i get the error plugin not installed. same error also with push plugin…
I had tried also with montesleo solution but nothing change…any idea?

52

2 Likes