Using Ngrok to Develop on Android Devices
This is how I test on mobile devices (Android phones) when developing.
It’s based on the official guide for remote debugging on Android devices with some extra steps I add to work on any web application project:
- Enable developer mode (click the Build Number 7 times!)
- Use ngrok to expose your local application
- Note that you’ll need to connect your agent to your ngrok authentication account
- Navigate to the .ngrok-free.dev URL from the device
- Plug your phone into your computer
- Open chrome://inspect#devices in a Chrome tab to get a dev inspector synced to your phone
Now you can inspect, modify elements, debug, throttle, etc! Happy coding!
Edit:
On my Windows machine running Ubuntu in WSL, I had to install ngrok with sudo
and get around an “invalid host header” error, so my full command to launch a project is:
sudo ngrok http --host-header=rewrite 8080