문제

I have added Cordova-2.7.0.jar file and js file in the PhoneGap application given in this link. But now i'm getting this error. How to solve this error?

enter image description here

도움이 되었습니까?

해결책 2

You need to update the plugin architecture (see here), something like this:

Replace:

import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
import org.apache.cordova.api.PluginResult.Status;

with:

import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;

Change:

public class PingPlugin extends Plugin {

to:

public class PingPlugin extends CordovaPlugin {

Change:

public PluginResult execute(String action, JSONArray args, String callbackId) {

to:

public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {

Change failed results such as:

return new PluginResult(PluginResult.Status.ERROR, e.getMessage());

to something like:

LOG.e("PingPlugin", "Error : " + e.getMessage());
return false;

Change success results such as:

return new PluginResult(PluginResult.Status.OK);

to something like:

callbackContext.success();
return true;

다른 팁

I found that in Cordova 3.0 you have to also remove "api" from the import statement.

Change

import org.apache.cordova.api.CordovaPlugin;
import org.apache.cordova.api.PluginResult;

To this:

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top