插件不能被解析为一个类型发出─科尔多瓦-2.7.0 [英] Plugin cannot be resolved to a type issue- cordova-2.7.0

查看:143
本文介绍了插件不能被解析为一个类型发出─科尔多瓦-2.7.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在的科尔多瓦-2.7.0.jar文件和js 文件=htt​​ps://github.com/trigger -corp /锻造-VS-科尔多瓦 - 性能/树/主/科尔多瓦相对=nofollow>这个链接。但是,现在我得到这个错误。如何解决这个问题?

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?

推荐答案

您需要更新的插件架构(的看到这里),是这样的:

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

替换:

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

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

修改

public class PingPlugin extends Plugin {

public class PingPlugin extends CordovaPlugin {

修改

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

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

切换失败的结果,如:

Change failed results such as:

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

要这样的:

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

更改成功的结果,如:

return new PluginResult(PluginResult.Status.OK);

要这样的:

callbackContext.success();
return true;

这篇关于插件不能被解析为一个类型发出─科尔多瓦-2.7.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆