Problems using custom plugins pulled directly from github

Friends,
I’m having another difficulty with the Ionic Package, and hope you can help me again.

We are using in our application the plugin to login with Facebook, however we had to make a fork of this plugin and change some things in its native source code for IOS.

So in our Ionic project we added this plugin by pulling it directly from our repository in github to use our custom version.

When we run a local build using the command:
Ionic cordova build ios

The plugin behaves as expected within the application by logging into Facebook successfully.

On the other hand, when I try to build in production through the Ionic Package, using the command:
Ionic package build ios --release --prod --profile=beta

The app simply comes without the plugin installed. I do not know what happens, but when I try to login with Facebook after generating the build through the Ionic Package, nothing happens. I installed a tool to check the application log (weinre) and the application simply ignores that the plugin exists. No error appears, but also no progress in the script that logs Facebook. Just stand there.

What could be happening? What is the compatibility of the Ionic Package to use custom plugins pulled directly from the github repository?
Is there any special parameter that should be passed to Ionic Package at the time of the build?

the plugin:

How does your config.xml and package.json refer to the plugin?

Normally the plugins “clobber” a global object into JS namespace that you then just “call” in the dev tools console, e.g. “window.cordova.plugins.foo” or similar. Try that with a plugin that is working and yours to check.

Remember that this app is made with Ionic v1.

This is how I refer to the plugin in config.xml:

    <plugin name="cordova-plugin-facebook4" spec="git+https://github.com/FactoryFire/cordova-plugin-facebook4.git#1.0.0">
        <variable name="APP_ID" value="662101583961094" />
        <variable name="APP_NAME" value="Viva Fitness" />
    </plugin>

And here’s how it’s in the package.json:

    "cordova": {
        "plugins": {
            "cordova-plugin-facebook4": {
                "APP_ID": "662101583961094",
                "APP_NAME": "Viva Fitness"
            }
        }
    }

Ok, I changed the category of the topic to reflect that it is a Ionic v1 project.

Hmm, is this the only location in your package.json where it appears? I am not sure if Ionic Package uses package.json or config.xml to download plugins - and right now it looks like only your config.xml includes your custom path to the plugin.

Exact! I also noticed that.
I see other plugins also configured in the CordovaPlugins session, but not the one I’m using.

Here’s the package.json:

    "cordovaPlugins": [
        "cordova-plugin-device",
        "cordova-plugin-console",
        "cordova-plugin-whitelist",
        "cordova-plugin-splashscreen",
        "cordova-plugin-statusbar",
        "ionic-plugin-keyboard",
        "cordova-plugin-camera",
        "cordova-plugin-inappbrowser",
        {
            "locator": "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git",
            "id": "cordova-plugin-x-toast"
        },
        {
            "locator": "https://github.com/Paldom/SpinnerDialog.git",
            "id": "cordova-plugin-spinner-dialog"
        },
        {
            "locator": "https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git",
            "id": "cordova-plugin-actionsheet"
        },
        {
            "locator": "https://github.com/pbernasconi/cordova-progressIndicator.git",
            "id": "org.pbernasconi.progressindicator"
        },
        {
            "locator": "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git",
            "id": "cordova-plugin-x-socialsharing"
        },
        {
            "locator": "https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git",
            "id": "cordova-plugin-datepicker"
        },
        {
            "variables": {
                "SENDER_ID": "xxx"
            },
            "locator": "phonegap-plugin-push",
            "id": "phonegap-plugin-push"
        }
    ],

Should I put it manually?

That would be one solution.
You could also uninstall the plugin, see via git what changed, and add it again. Might be better to understand what is going wrong.

I’ve done this task, uninstall and re-install some three consecutive times and nothing changes in the behavior of the plugin.

I am now awaiting the build of the Ionic Package with the change made manually in the package.json

1 Like

Hm interesting, maybe it works different than one would expect it to.

What is your ionic info output?

my Ionic info:

cli packages:

    @ionic/cli-plugin-cordova : 1.5.0 (/home/walter/workspace/0-javascript/0-ionic/dieta-fit-app/node_modules/@ionic/cli-plugin-cordova)
    @ionic/cli-plugin-gulp    : 1.1.0 (/home/walter/workspace/0-javascript/0-ionic/dieta-fit-app/node_modules/@ionic/cli-plugin-gulp)
    @ionic/cli-plugin-ionic1  : 2.1.0 (/home/walter/workspace/0-javascript/0-ionic/dieta-fit-app/node_modules/@ionic/cli-plugin-ionic1)
    @ionic/cli-utils          : 1.6.0 (/home/walter/workspace/0-javascript/0-ionic/dieta-fit-app/node_modules/@ionic/cli-utils)
    ionic (Ionic CLI)         : 3.6.0 (/home/walter/workspace/0-javascript/0-ionic/dieta-fit-app/node_modules/ionic)

global packages:

    Cordova CLI : 7.0.1 
    Gulp CLI    : CLI version 3.8.7 Local version 3.9.1

local packages:

    Cordova Platforms : android 6.2.3 browser 4.1.0 ios 4.4.0
    Ionic Framework   : ionic1 1.3.1

System:

    Android SDK Tools : 26.0.2
    Node              : v7.10.0
    OS                : Linux 4.10
    npm               : 5.2.0

It did not work. I have now tested the build done by Ionic Package with the package.json changed manually including the path of the plugin repository, and still nothing works.

Actually this behavior is interesting, since if I do a local build to run in the emulator and a connected device, the plugin works.

The problem seems to be exactly in the build done there at the Ionic …

Yeah, they might be doing something different.

Have you done a new checkout of your project and run npm install and ionic cordova prepare to see if the plugin is installed correct locally from a fresh checkout?

Otherweise: http://ionicframework.com/support#support

1 Like