Run Ionic app on Android device (Different Ways)

I have Android device. I want to run my ionic app on that android device.

What are the different ways to run the ionic app on android device?

Also I want to see the debug console of app, because I want to make sure API’s are getting called properly and some logs are printed or not.

Earlier I used to run the app on emulator and inspect the console using chrome://inspect/#devices

You can run it on your Android device as a PWA of sorts by opening it in Chrome and adding it to your home screen.

Otherwise, you would use Capacitor to bundle it up into a native app.

In either case, you can still use chrome://inspect/#devices.

1 Like

Thanks, @twestrick.
Running the app as a PWA will not be useful for me, as I am storing the data in SQLITE DB and fetching the data and showing on the UI.
I have made an app, for android only using ionic.
While using capacitor also I am not able to run the app, it is showing white screen. I am running it while connecting the USB.

A white screen usually means some sort of JS error. Check DevTools and LogCat in Android Studio.

Assuming you are trying to run it via live reload, another possible problem is that you didn’t open up the port in your firewall on your PC. For live reload, I had to open up port 8100 and 6001. I only allow access from the IP of my Android phone.

I am running below script using npm run live-reload.
“live-reload”: “ionic cap open android && ionic cap build android && ionic cap sync android && ionic cap run android -l --external”
The app gets installed on samsung deivce connected via USB but getting below error.

Below is the log cat logs

The screenshot of the app saying ERR_ADDRESS_UNREACHABLE points to a firewall issue. The phone will be trying to access your computer over your local network at the IP given. You need to open up ports 8100 and 6001 in your computer’s firewall. 8100 for the web assets of your app itself and 6001 for livereload (6001 at least was for me using Vue and Vite).

Once you fix that, let’s see if the JS error in LogCat goes away.

As a side note, you only need to run one command:

ionic cap run android -l --external

That one command builds and syncs your app :grin:

i also use android studio to view the debug output (logcat) of my ionic app,
just like i use xcode for the ios version

plugged in via usb cable