'Cordova console.log not working
Hello I downloaded and installed node.js as I have done million times also I installed cordova as mentioned in their docs. Furthermore I installed console.plugin with "cordova plugin add org.apache.cordova.console". Finally I did cordova build android and the cordova emulate android, and inside www/js/index.js onDeviceReady I simply entered this console.log('test');
I'm new with cordova and I cant figure out why I dont see and output in my terminal.
PS: I'm on ubuntu 12.04 LTS 64bit, and I dont use eclipse. Shouldn't I see the console.log output in my terminal window ?
Solution 1:[1]
The output will appear in an output window, not in the terminal window.
I run my Android Cordova apps in Eclipse and logs appear in the Logcat output window, similarly with iOS apps and Xcode, they appear in the Xcode output window.
You could always just alert()
or navigator.notification.alert()
to quickly see your logged values.
Hope this helps.
Solution 2:[2]
From the CLI run your Android project and display console output from chromium (if using Crosswalk) or SystemWebViewClient. View Debugging priority and above logs from these places, and silence everything else.
cordova run android && adb logcat chromium:D SystemWebViewClient:D *:S
Solution 3:[3]
Using alert()
is a rather dilettantish debug methodology. The most simple is to use a hardware device or an emulator with adb
and chrome://inspect
. This provides the debug bridge for the Cordova WebView
, as well as the JS console, JS debugger, DOM inspector, etc. within Chrome.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lee Crossley |
Solution 2 | James L. |
Solution 3 |