Plugins not copied to platforms/Android

#1

I updated to latest Ionic 2 RC0:

$ ionic -v
2.1.0

$ cordova -v
5.0.0

$ node -v
v5.6.0

$ npm -v
3.9.2

I added the Android platform with command ionic platform add android@4.1.1 and managed to compile and run it on my device, but I noticed that window.open(..) doesn’t do anything (i.e. - it should open an email client) even though I previously added the cordova-plugin-inappbrowser plugin. So after further investigation I realized that plugins/android.json is “empty”:

{
    "prepare_queue": {
        "installed": [],
        "uninstalled": []
    },
    "config_munge": {
        "files": {}
    },
    "installed_plugins": {},
    "dependent_plugins": {}
}

Also, I noticed that my platforms/android/src/ doesn’t contain any plugins code. Does anybody know why is this happening?

I managed to fix this temporarily by copying over the android.json file and the plugins code to the platforms/android/src/ folder from one of my older (beta) projects. However, this is isn’t really the solution, so I’m wondering why the android.json is not properly generated and no plugins are copied over to platform?

#2

I have a similar problem. I cloned my repo onto a new machine and did some setup to try to regenerate the .gitignore files, such as
npm install

My app now works on my web browser, but not natively on an android device. my plugins/android.json file is also empty. I could manually copy it from my old machine, but this is obviously only putting a bandaid on a bigger problem.

Any ideas?

#3

UPDATE:
I have a theory about why this happened (at least in my case):
I installed the plugin code with npm install (which used packagelock.json to find node modules to install)
but since I did not install them with ionic cordova plugin add <name_of_plugin>, the ionic CLI did not know to include the plugin in the “installed_plugins” property of plugins/android.json
I did install a couple of plugins with the Ionic CLI and their names were included. So, I think the lesson here is to install plugins with the Ionic CLI or make sure you track plugins/android.json (and the equivalent ios.json)

It looks like Ionic’s .gitignore automatically ignores plugin/android.json …I’m not sure that this is such a good idea but I’m probably overlooking something

#4

anyone has an idea why this happened and have a solution ?
I could build the app and install it but it doesn’t work, i thought this is the problem…