Ionic 4 Capacitor

I would like to use Google Analytics in my App, and it should be supported in Ionic 4 according to this


but I am running Capacitor, so can anyone help me with install instructions, as I have installed the native as that is supported by Capacitor according to the documentation, but should I also install the cordova plugin?

No matter if the cordova plugin is installed or not I get this error

image

and that is this code

image

so basically the Native wrapper is trying to do something with Cordova.

Anyone know how this is supposed to work?

Only the 5 or 6 times I copy/paste the exact same answer…anyway

2 Likes

Thx for taking the time to help. I might have used the wrong search criterias thinking it was a plugin problem

So basically to switch from Cordova to Capacitor I should add /ngx to the import and if that fails like here

image

I have to get to the correct version of the @ionic-native for that plugin.

And the cordova-plugin should be installed as normally?

To me it looks like that I now have the latest version of Ionic-Native, and that even using ngx is trying to load Cordova

I think mix up many questions inside the same question, you maybe need to do some more searches first

What I have answered is the fact that the error you were facing is related to ionic-native v5-beta if not correctly imported

Then what’s capacitor how to use capacitor, you could have a look at the documentation https://capacitor.ionicframework.com

About how to include a Cordova plugin inside capacitor, I don’t know, never tried so far

About your last screenshot, I guess it’s because you include a cordova plugin in a project where you use capacitor and there is probably something not configured correctly

I have spent hours (reading) now trying to figure out how we should use cordova plugins, where the functionality is still missing in Capacitor, but basically just found a post claiming @ionic-native will be compatible with Capacitor, but no description of how it should work.

Switching to a new version is always hard work, and there are som many new errors to make - mostly mine :slight_smile:

But lets see when I get to the next plugin if the problem is the same.

Sorry that I couldn’t help more, really. I never tried so far to include cordova plugin in a project where capacitor is used

But note, if it’s a cordova plugin I think it’s not a must to use ionic native, it’s a wrapper, you could do without too (“window.cordova.etc”)

Good luck, hope someone could point you in the right direction