Reputation: 175
There is a way to debug? I use
ionic run android
command to run the app on android but then - how can I see console.log() messages?
Thanks
Upvotes: 11
Views: 26146
Reputation: 11
with Ionic 5 and cordova 9 use:
ionic cordova run android -l --consolelogs
where -l
is for livereload
Upvotes: 1
Reputation: 1689
Connect your android device to computer/laptop and simply run below command
ionic cordova run android --device -l --debug
Upvotes: 0
Reputation: 645
If you want a real debug, with watches, step into, etc, try the Cordova Tools extension for Visual Studio Code
The page constains the instructions for debuging on device.
Upvotes: 0
Reputation: 743
Connect with an android device which has Android OS version >= 5
Enable developer option from the settings. This procedure varies from device to device. In addition you must enable USB debugging mode from developer option or from other section of your device.
If you get any error like “Your device is not connected” from Android SDK or Android studio then find out the problem from your device manager of pc. Most of the time appropriate driver or driver is not installed in the machine. Download it and follow my instruction in a video (Yafi Tech).
Run the command ionic cordova run android
. APK is built and installed in the device. done
run “chrome://inspect” in the chrome status bar. Remote debugging of connected device has been started.
Now run the installed application and operate from the device or chrome.
Click on inspect of WebView. For debugging Go to the console of browser if you want to trace out any error.
you can also watch video here
Upvotes: 5
Reputation: 10549
The Ionic CLI has been updated for ionic 2+ to deploy app in live reload mode use the following command.
Synopsis
$ ionic cordova run <platform> <options>
Example
$ ionic cordova run android -l -c
Make sure that you have installed the latest version of Ionic/Cordova CLI
Upvotes: 2
Reputation: 438
Now that there is a livereload option (-l), to see the console.log
messages you have to use -c or --consolelogs
But to have logs, the livereload option is required so :
ionic run android -lc
See the documentation for more options : http://ionicframework.com/docs/v1/cli/run.html
Upvotes: 2
Reputation: 91
From ionic doc
ionic run ios [options]
http://ionicframework.com/docs/cli/run.html
Upvotes: -4
Reputation: 2314
If you run your app in the livereload mode you will see the console.log()
messages. You can start it like this:
ionic run android -l
You can also use chrome developer tools like it would be a normal webpage. Here is good description how you achieve that: Remote Debugging on Android with Chrome
Upvotes: 19