Amit Prajapati
Amit Prajapati

Reputation: 14315

Failed to run constructor: TypeError: Result of expression 'cordova.addPlugin' [undefined] is not a function

I would try to make one code in phonegap there was occur one problem please help to solve this error.

Failed to run constructor: TypeError: Result of expression 'cordova.addPlugin' [undefined] is not a function.

Upvotes: 0

Views: 1128

Answers (1)

Byron Sommardahl
Byron Sommardahl

Reputation: 13002

That error simply means that 'cordova' was never initialized. That could be because of one of the following possibilities:

  1. You didn't include some version of cordova-X.X.X.js in your index.html file.
  2. You have the cordova-X.X.X.js script referenced in your index.html, but the cordova-X.X.X.js doesn't exist in the path that you provided.
  3. You are developing on iOS and you're trying to use the cordova-X.X.X.js that was made for Android (substitute any platforms there... the point is you have to use the cordova-X.X.X.js that was made for the platform for which you are developing).

If you're using Cordova 2.3.0, all the references to cordova-X.X.X.js above will be cordova-2.3.0.js.

Here is the full documentation to Cordova 2.3.0: http://docs.phonegap.com/en/2.3.0/index.html

Here are various getting started guides, one for each of the platforms that Cordova supports: http://docs.phonegap.com/en/2.3.0/guide_getting-started_index.md.html#Getting%20Started%20Guides

If this answer didn't solve your problem, you need to edit your question and fill in some missing information: Platform, Cordova version, code samples.

Upvotes: 2

Related Questions