Got "Plugin not loaded" error using ionic-deploy


#1

Hi guys, I tried to use ionic-deploy to update my app without resubmitting to App Store.

And the app got updated for the first time, everything is fine, but after that, I keep getting “Plugin not loaded” error.

I’ve referenced this topic, but still I get the same error.

After reading through the docs, I found this line

Be careful not to deploy versions of your app which user old versions of the components, as you may lose access to your cordova native plugins.
But I don’t know what it’s talking about, should I check my ionic version?

Here’s my ionic info:

$ ionic info

Your system information:

OS: Mac OS X Yosemite
Node Version: v0.12.0
Cordova CLI: 5.0.0
Ionic CLI Version: 1.3.16
Xcode version: Xcode 6.3.2 Build version 6D2105
ios-sim version: 3.1.1

Here’s my code:

    $ionicDeploy.check().then(function (response) {
          if (response) {
            alert("Update Process ---------  Has Update!");
            $ionicDeploy.download().then(function() {
              alert("Update Process   -------    Downloaded!");
              $ionicDeploy.extract().then(function() {
                alert("Update Process  -------  Extracted!!");
                $ionicDeploy.load();
              }, function(error) {
              }, function(progress) {
              });
            }, function(error) {
            }, function(progress) {
            });
          } else {
            // No updates, load the most up to date version of the app
            $ionicDeploy.load();
          }
        },
        function(error) {
          console.error("ionicdeploy error", error);
          alert("Update Error   " + JSON.stringify(error));
        });
  });

Ionic Deploy: Disabled! Deploy plugin is not installed or has not loaded. Have you run `ionic plugin add ionic-plugin-deploy` yet?
#2

I hade this same issue,

  1. check that you checking for updates on plafrom ready.
  2. check that you put app key and app id before.

#3

Thank you vitaly87,

I did put the check code above in app.js and inside .run function:

.run(function($ionicPlatform, $ionicDeploy) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }

    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleLightContent();
    }

    $ionicDeploy.check().then(function (response) {
    ......

And I’ve checked that I’ve put my app_id and app_key in config section:

.config(function($ionicAppProvider, $stateProvider, $urlRouterProvider) {
  $ionicAppProvider.identify({
    // The App ID (from apps.ionic.io) for the server
    app_id: 'XXXXX',
    // The public API key all services will use for this app
    api_key: 'XXXXXXX'
  });

What else should I check?


#4

can you debug you app to see if any errors on console, are you testing it with really env? because it will not work if you are testing it not on device, also did you do ionic upload?
after you doing ionic upload you should also do deploy from ionic view


#5

Yes, I’m debugging on a real device, and I’ve uploaded to apps.ionic.io using ionic upload command. And I deployed it with apps.ionic.io.

While checking the log output using dab logcat, I got Plugin not loaded error as well.


#6

please debug it with chrome and adb of chrome it really good, this to debug your device , on can console see errors and so on, I think the solution is very simple for you, please try to use cordova-plugin-whitelist

on your project and also dont forget to add index.html the correct:
Content-Security-Policy


#7

Thanks vitaly87! But I still can’t figured it out… Do you have a working demo to share with me?


#8

I didn’t get what isn’t working?

looks like you didnt debug your device… without it it will be very hard to find the issue…
I think you should see the console errors… I think it permission issue with network…
about the examples of white list you can see many on google…

about updates you can see on https://github.com/ look for search $ionicDeploy.check().then(function(response) {

also check that you have at least 2 plugins : com.ionic.deploy,cordova-plugin-whitelist
you will see many examples.


#9

Well, I’m debugging on my device, and I do have the permission for network. Actually, I can download and update my app from internet.

The problem is, when I updated my app, if I deploy a new upload, I got the “Plugin not loaded” issue…


#10

Thank you vitaly87! It is the problem with Content-Security-Policy ,when I added it to my index.html, it works like a charm. Thank you!


#11

Could you please be so kind and post a code example? i don’t get it running… Would be nice!


#12

Hi,

I too facing the same problem. What did you mention in you Content-Security-Policy?


#13

Hi, sorry for the super later reply…

First of all, I’ve added the cordova-plugin-whitelist plugin to my project.

Then, I’ve added this following line to my index.html file (taken from README from that plugin project):

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

It works for me.


#14

Hi recruitx, please refer to the previous answer.