Cordova – In Android Phonegap “Unable to run constructor: ReferenceError: Unfained PLUGINMANAGER”

How to stop running the constructor failed: ReferenceError: PluginManager is not defined error in PhoneGap in Android?
In PhoneGap version 1.0, they changed the plug-in mechanism.

Add The old method of the plugin is in the PhoneGap.addConstructor section of the javascript file of the plugin.

You will have something similar

PhoneGap.addConstructor(function() {
PhoneGap.addPlugin('analytics', new Analytics());
PluginManager.addService("GoogleAnalyticsTracker", "com.phonegap.plugins.analytics.GoogleAnalyticsTracker");
}) ;

However, in the newer version, you can now perform the addService step in the res/xml/plugins.xml file.

So in my case, I use The one is the Google Analytics plugin that is still using the old method. It doesn’t seem to do any harm because I think it will be ignored. However, if you want to eliminate the error, just comment out the PluginManager.addService(… ..) line.

How to stop running the constructor failed: ReferenceError: PluginManager is not defined error in PhoneGap in Android?

In the 1.0 version of PhoneGap, they changed the plugin mechanism.

The old way to add plugins is in PhoneGap of the plugin’s javascript file .addConstructor section.

You will have something similar

PhoneGap.addConstructor(function() {
PhoneGap.addPlugin('analytics' , new Analytics());
PluginManager.addService("GoogleAnalyticsTracker", "com.phonegap.plugins.analytics.GoogleAnalyticsTracker");
});

However, in comparison In the new version, you can now perform the addService step in the res/xml/plugins.xml file.

So in my case, I am using the Google Analytics plugin which is still using the old method. It doesn’t seem to do any harm because I think it will be ignored. However, if you want to eliminate the error, just comment out the PluginManager.addService(…..) line in the analytics.js file.

Leave a Comment

Your email address will not be published.