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
To do this simply plug in your device and run: $ ionic cordova run android or $ ionic capacitor run android whether you are using Cordova or Capacitor. If you encounter any problem or the above command isn't working, make sure that you have selected USB debugging from your device.
To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.
Developer Options & USB Debugging are enabled by default in the Android emulator. Open the Chrome browser and navigate to the URL chrome://inspect/#devices . Your connected Android device should show up in the list of Remote Targets. On your device, open the Ionic app that you would like to debug using Chrome.
If you use a real device, ensure that debugging is enabled both from the device and on the remote browser. In Android, you need to go to the settings and enable developer mode first and then USB Debugging under the developer options menu. If you do not see the Developer options menu, you need first to enable it.
with Ionic 5 and cordova 9 use:
ionic cordova run android -l --consolelogs
where -l
is for livereload
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With