Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debug android app with ionic- cordova

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

like image 675
ן123456 Avatar asked Jun 23 '15 18:06

ן123456


People also ask

How do you debug an Android app on Ionic Cordova?

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.

How do I use Ionic Cordova app on Android?

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.

How do you debug an Ionic app on Android emulator?

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.

How do you debug an Ionic app on a real device?

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.


2 Answers

with Ionic 5 and cordova 9 use:

ionic cordova run android -l --consolelogs

where -l is for livereload

like image 72
ward Avatar answered Sep 30 '22 12:09

ward


  1. Connect with an android device which has Android OS version >= 5

  2. 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.

  3. 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).

  4. Run the command ionic cordova run android. APK is built and installed in the device. done

  5. run “chrome://inspect” in the chrome status bar. Remote debugging of connected device has been started.

  6. Now run the installed application and operate from the device or chrome.

  7. 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

like image 40
Yusuf Avatar answered Sep 30 '22 12:09

Yusuf