How to debug Ionic5/Capacitor app on Android devices?

Hi,
I used to debug Ionic/Cordova apps on a device using the command:
ionic cordova run android -l

So that each modification was loaded in real-time.

How can I debug an Ionic/Capacitor app in a similar way?
Do I have to run each time these commands?

ionic build
npx cap sync android
npx cap open android

Thank you very much

cld


" Unfortunately, programmatically building and launching the native project is not yet supported."
ionic capacitor run android -l

It is much easier to debug apps, on real devices, with Cordova :frowning:

If you run

ionic capacitor run android --livereload --external

this should open Android Studio and from there you can run the app in a device or emulator.

3 Likes

Thank you Mirko,
to make your command work I’ve added this line to AndroidMannifest.xml:

    <application
...
        android:usesCleartextTraffic="true">

....
</application>

cld