How to enable debug mode when running app on android


#1

I am trying to debug my code when running on android
connected via usb to the laptop (ble testing)

I open the app via chrome://inspect and can see console messages.
However, if I put debugger statements in the code, then they get
removed. There is also no source maps and I can’t put breakpoints
on the minified code.
If I do similar things in the browser, it all works.

Is there an option to avoid minifications and keeping source maps,
when app is running on android?

I tried to supply a “–debug”, but it does not seem to have an effect.
ionic run android --debug


#2

You can pass --dev to ionic-app-scripts. E.g. in package.json you can change

    "build": "ionic-app-scripts build"

to

    "build": "ionic-app-scripts build --dev"

Ideally --debug should enable --dev automatically, like I mentioned in this issue.


#3

Thank you, it worked!