使用Cordova phonegap找不到模块cordova / exec / proxy

时间:2014-05-07 16:04:27

标签: javascript android cordova cordova-3

我是Cordova和Phonegap的新手,我正在尝试开发一个简单的应用程序来创建联系人并在我的Android上运行它(looking at this example) 我将我的应用程序加载到手机上,我的应用程序已初始化(已收到事件初始化)但在任何其他事件之前我收到此异常:

05-07 17:52:17.870: E/Web Console(22339): Uncaught module cordova/exec/proxy not found at file:///android_asset/www/cordova.js:55

这是我的 index.js

var app = {
// Application Constructor
initialize: function() {
    this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
    console.log(" bindEvents ...");
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
     console.log("onDeviceReady ...");
    app.receivedEvent('deviceready');
    var myContact = navigator.contacts.create({"displayName":"Test User"});
    myContact.note = "this contact has a note.";
    console.log("the contact, " + myContact.displayName + ", note: " + myContact.note);
    app.receivedEvent("contactcreated");
    myContact.save(app.onContactSaveSuccess,app.onContactSaveError);
},
// Update DOM on a Received Event
receivedEvent: function(id) {
    console.log("receivedEvent ...");
    var parentElement = document.getElementById(id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');

    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');

    console.log('Received Event: ' + id);
},

onContactSaveSuccess: function(contact) {
    console.log("onContactSaveSuccess ...");
    window.alert("Save Success");
},

onContactSaveError: function(contact) {
    console.log("onContactSaveError ...");
    window.alert("Save Failed");
},

};

问题:

  1. 什么是 cordova exec代理模块?

  2. 怎么可能解决呢?

  3. 这是我的cordova版本:3.1.0-0.2.0

0 个答案:

没有答案