4

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 ?

3 Answers 3

5

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

Sign up to request clarification or add additional context in comments.

Comments

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.

See Get Started with Remote Debugging Android Devices.

Comments

2

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.

3 Comments

Is there a plugin that or a built in functionality that could output to the terminal ?
Not that I'm aware of, I believe the CLI process exits when the app is launched and this would be out of scope for a plugin. You can always request features and report issues at issues.apache.org/jira/browse/CB
If you're not using Eclipse there's a LogCat window in Android Device Monitor. It's in the Android SDK tools folder, monitor or monitor.bat on Windows. You'll want to create a filter for your app or you'll see logs from everything.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.