Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 714
0x_Anakin Avatar asked Feb 14 '23 02:02

0x_Anakin


2 Answers

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

like image 77
James L. Avatar answered Feb 15 '23 19:02

James L.


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.

See Get Started with Remote Debugging Android Devices.

like image 37
Martin Zeitler Avatar answered Feb 15 '23 19:02

Martin Zeitler