Android 未捕获类型错误:无法调用方法';列表';未定义的

Android 未捕获类型错误:无法调用方法';列表';未定义的,android,jquery,cordova,Android,Jquery,Cordova,我正在开发一个Phonegap插件。我的HTML文件如下所示: <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> function fun(){ alert("hai I am alert"); window.plugins.Unixell.list(SuccessCallBack ,failureCallBack); function Succe

我正在开发一个Phonegap插件。我的HTML文件如下所示:

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
  function fun(){
    alert("hai I am alert");
    window.plugins.Unixell.list(SuccessCallBack ,failureCallBack);
    function SuccessCallBack() {
      alert("success");
    };
    function failureCallBack() {
      alert("failure");
    };
  }
</script>
</head>
<body>
  <input type="button" value="i am button" onclick="fun()" />
  <script src='apis/Phonegap.js'></script>
  <script src='apis/Unixell.js'></script>
</body>
</html>
我的com.phonegap.plugins.unixell.unixell.java文件是:

public class Unixell extends Plugin{
  private static final String TAG = "unixell";
  private static final String ACTION = "list";
  @Override
    public PluginResult execute(String action, JSONArray arg1, String arg2) {
      // TODO Auto-generated method stub
      PluginResult result = null;
      result=new PluginResult(Status.OK, "I am a message");
      if(ACTION.equals(action)){
        System.out.println("success");
        LOG.d(TAG,"U R success");
      }
      return result;
    }
但我在logcat中发现了一个错误:

Uncaught TypeError: Cannot call method 'list' of undefined at file:///android_asset/www/index.html

有什么问题吗?为什么我会犯这个错误?这个问题的解决方案是什么?

我想您可以通过执行Unixell.prototype.list来获得一个函数,就像您定义的那样,但我没有在Phonegap上做很多工作;-)

在HTML文件中,您声明的是
window.plugins.Unixell
,但在JS文件中,您声明的是
var-cam=function(){}选择一个。因为到目前为止没有Unixell.list,只有一个cam.list函数…

Hi现在我将js文件更改为这样….var Unixell=function(){};Unixell.prototype.list=函数(参数,successCallback,failureCallback){//return PhoneGap.exec(successCallback,failureCallback,'BluetoothPlugin','listDevices',[argument]);console.log(“输入函数”);alert(“输入函数”);};PhoneGap.addConstructor(function(){alert(“我在unixell.js3333中”);PhoneGap.addPlugin(“unixell”,new unixell());//PluginManager.addService(“unixell”,“com.PhoneGap.plugins.unixell.unixell”);
Uncaught TypeError: Cannot call method 'list' of undefined at file:///android_asset/www/index.html