Cordova 2.7.0 PushPlugin “cordova cannot be resolved” and “ctx cannot be resolved”

人盡茶涼 提交于 2019-12-10 23:43:58

问题


What I've done....

  • Created the cordova project using ./create in the cordova-android bin
  • Added PushPlugin via cordova-plugman
  • Added cordova-2.7.0.jar to the /libs directory

Cordova is complaining in PushPlugin.java that "cordova cannot be resolved" ...along with several other errors...

(PushPlugin.java) Plugin cannot be resolved to a type
(PushPlugin.java) Plugin cannot be resolved to a type
(PushPlugin.java) cordova cannot be resolved
(PushPlugin.java) Plugin cannot be resolved to a type
(PushPlugin.java) Plugin cannot be resolved to a type
(PushPlugin.java) ctx cannot be resolved or is not a field
(PushPlugin.java) ctx cannot be resolved
(PushPlugin.java) ctx cannot be resolved
(PushPlugin.java) ctx cannot be resolved or is not a field
(PushPlugin.java) Plugin cannot be resolved to a type
(PushPlugin.java) The method execute(String, JSONArray, String) of type PushPlugin must override or implement a supertype method

I've added the cordova-2.7.0 project to the class path via Project >> Properties >> JAVA Build Path >> Add Jar Files

I've also ran... Project >> clean

Can't seem to figure this one out... it's been several days and many google searches.

Best Regards, John


回答1:


See the latest commit at: NetMatch:PushPlugin github

Looks like the man did a great job at cleaning up the plugin for recent cordova releases. Still awaiting the PushPlugin repo to accept the pull request.




回答2:


I'm troubleshooting a similar problem with the ChildBrowser plugin in Cordova 2.7.0. Changing extends Plugin to extends CordovaPlugin in the plugin class declaration got rid of the "cordova cannot be resolved" errors on my end. See if the following change works for you:

public class PushPlugin extends Plugin {

to:

public class PushPlugin extends CordovaPlugin {


来源:https://stackoverflow.com/questions/16576579/cordova-2-7-0-pushplugin-cordova-cannot-be-resolved-and-ctx-cannot-be-resolve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!