0

I am creating a android app using cordova 2.2.0.Now i am geting error on datepicker plugin. I installed date picker plugin refer this link https://github.com/phonegap/phonegap-plugins/tree/master/Android/DatePicker.

Now i get Uncaught TypeError: Cannot read property 'datePicker' of undefined. Please guide me.

Thanks for your help.

Arunkumar
  • 11
  • 4

1 Answers1

0

Make sure that you placed the DatePickerPlugin.java in the correct package. They recently updated the plugin's Java file to match the new CordovaPlugin class, but forgot to update the README.

DatePickerPlugin.java should be in a package named com.phonegap.plugins (notice the s at the end.)

Then in your config.xml, you should have <plugin name="DatePickerPlugin" value="com.phonegap.plugins.DatePickerPlugin"/>, again, notice the s in plugins.

Additionally, I noticed in the README that they do not tell you to include the .js file in your HTML page. If you want to actually use the plugin, make sure that you add this into your HTML page: <script type="text/javascript" charset="utf-8" src="datePickerPlugin.js"></script>. This is actually probably your problem based on that error message.

MBillau
  • 5,366
  • 2
  • 28
  • 29