我添加了插件
cordova plugin add cordova-plugin-console我在adroid上模拟了创建的默认项目(带有设备就绪事件演示)
在我看到的那只猫里
I/chromium( 1330): [INFO:CONSOLE(173)] "Received Event deviceReady", source: file:///android_asset/www/plugins/cordova-plugin-console/www/console-via-logger.js (173)
D/PluginManager( 1330): exec() call to unknown plugin: Console这是一个问题,因为我没有跟踪console.log调用时的行,这会在调试时造成一些麻烦。
这是我的“压缩”js代码
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicitly call 'app.receivedEvent(...);'
onDeviceReady: function() {
var parentElement = document.getElementById("deviceready");
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event deviceReady');
},
};
app.initialize();另外,我想知道为什么一个新创建的项目已经出现了错误!!
编辑:我已经尝试删除和重新添加插件,但这还没有解决问题。
发布于 2015-08-07 14:34:38
通过cordova plugin删除和读取插件不起作用。
简单地说,使用npm安装插件
cordova plugin remove cordova-plugin-console
npm install cordova-plugin-console在重新启动我的cordova项目的android仿真之后,一切都正常。
现在,我有了预期的日志行(为了更好的阅读,这里分成了2行):
I/chromium( 1416): [INFO:CONSOLE(36)] "Received Event deviceReady",
source: file:///android_asset/www/js/index.js (36)https://stackoverflow.com/questions/31879818
复制相似问题