android - unable to create cordova plugin -


i new android development. using phonegap android development. creating calendarevent plugin , getting following error. don't know why error occurs.

 05-21 22:39:12.171: w/dalvikvm(516): vfy: unable resolve direct method 345:  landroid/webkit/webview;. (landroid/content/context;landroid/util/attributeset;iz)v 

this javascript code:

window.createevent = function(title, location, description, startdate, enddate) {     return cordova.exec(function(arg){}, function(error){}, 'calendarplugin', 'createevent',             [title, location, description, startdate, enddate]); };  var title = "test event"; var location = "nashville, tn"; var description = "very interesting event."; var startdatetime = "2015-09-09t16:00:00-06:00"; // iso 8601 date var enddatetime = "2015-09-09t18:00:00-06:00";  window.createevent(title, location, description, startdatetime, enddatetime); 

and plugin code:

package com.redobot.plugin;  import java.text.parseexception; import java.text.simpledateformat; import java.util.calendar; import java.util.date; import java.util.locale; import java.util.timezone;  import org.apache.cordova.api.plugin; import org.apache.cordova.api.pluginresult; import org.json.jsonarray; import org.json.jsonexception;  import android.content.intent; import android.provider.calendarcontract.events;  public class calendarplugin extends plugin {     final static string iso8601dateformat = "yyyy-mm-dd't'hh:mm:ssz";      @override     public pluginresult execute(string action, jsonarray args, final string callbackid) {         if (action.equals("createevent")) {             try {                 this.createevent(args.getstring(0), args.getstring(1), args.getstring(2), args.getstring(3), args.getstring(4));             } catch (jsonexception e) {                 e.printstacktrace();             }             return new pluginresult(pluginresult.status.ok, true );         }         return new pluginresult(pluginresult.status.ok, false );     }      private void createevent(string title, string location, string description, string startdate, string enddate){         calendar calendarstart = calendarplugin.getcalendarfromiso(startdate);         calendar calendarend = calendarplugin.getcalendarfromiso(enddate);          intent intent = new intent(intent.action_edit);         intent.settype("vnd.android.cursor.item/event");         intent.putextra(events.title, title);         intent.putextra(events.event_location, location);         intent.putextra(events.description, description);         intent.putextra("begintime", calendarstart.gettimeinmillis());         intent.putextra("endtime", calendarend.gettimeinmillis());          this.cordova.getactivity().startactivity(intent);     }      public static calendar getcalendarfromiso(string datestring) {         datestring = datestring.trim().replaceall(":00$", "00"); // changing format simpledateformat          calendar calendar = calendar.getinstance(timezone.getdefault(), locale.getdefault());         simpledateformat dateformat = new simpledateformat(iso8601dateformat, locale.getdefault());          try {             date date = dateformat.parse(datestring);             calendar.settime(date);         } catch (parseexception e) {             e.printstacktrace();         }          return calendar;     } } 

please tell wrong. searched, couldn't useful help.

i tested code nexus 7 device running android 4.2.2 creating cordova 2.6 app , running it, , worked fine. had add config.xml: <plugin name="calendarplugin" value="com.redobot.plugin.calendarplugin" /> , add code inside of ondeviceready() check, other that, no problem.


Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -