Skip to content
All writing
Engineering · 6 min read

How to Debug on Mobile, and How It Differs from the Web

How debugging on a phone differs from the web: no DevTools, an app around your page, and an OS around the app. Terms, a route map, and 11 parts.

On the web, you debug a page. On a phone, you debug the page, the app around it, and the OS around the app.

Terms used in this series

Each essay also defines these at first use.

Term Meaning
click script the ad’s JavaScript that records the tap and opens the ad’s page.
click tracker a server that gets a short message for each tap and adds one to a count.
device log the phone’s system log, read from a computer with idevicesyslog (iOS) or adb logcat (Android).
feed the scrolling list of posts and ads inside an app.
HAR a file that records every request the phone sent and every reply.
landing page the page or app that the ad promises to open.
ping a background request that only reports an event.
proxy a server between the phone and the internet that relays its traffic.
SDK a code library that an app builds in. Here, it shows ads.
WebView a browser engine inside an app, with no tabs or address bar.

The question

On the web, debugging starts with one shortcut: open DevTools. The console shows your logs. The Network panel shows every request. You change a line and reload.

Then your code runs on a phone. It can run in a mobile browser, in a WebView inside an app, or inside an app that another company builds. You want the same view as on the web: what ran, what was sent, and what opened. But the phone has no DevTools button, and an app does not let you in by default.

So on mobile, you do not start with the bug. You start with this question: how do I see what happens, the way I do on the web?

The running example

Each essay uses one case to show the idea. Users tap an ad inside an app, and nothing opens. The same ad works in Safari on the same phone.

Web vs mobile: what changes

What you need On the web On a phone, inside another app
See the code run DevTools on the same machine The host app (the app that holds the page) owns the WebView (a browser engine inside an app). No DevTools unless the app turns on inspection
See the network The Network panel A proxy between the phone and the internet records a HAR (a file of every request and reply)
See what the OS did The OS log is on the same computer (macOS Console app, Windows Event Viewer). You rarely need it, because a link opens in a tab The log is on another device. Read it from a computer with idevicesyslog or adb logcat. You often need it, because an app opening is not a request
Change the code Edit and reload You do not own the build. Rewrite the response on its way to the phone, and stop the phone from using its old cached copy
Trust a test The test runs where the user runs A proxy test changes only what the phone receives
Find the layer Usually one page App, SDK (the ad library inside the app), WebView, page, iframe (a page inside a page), ad: each one can stop the tap

Each row is one or two essays in this series.

Route map

Series route map From the symptom, where the data shows clicks but the user sees nothing, five stages of the series lead to the answer: find the layer that stops the tap and prove it with a test. 1 2 3 4 5 Symptom data shows clicks, user sees nothing What a tap does parts 01 → 02 The app around the page parts 03 → 04 See what happened parts 05 → 06 Change what the phone runs parts 07 → 08 Find the cause parts 09 → 10 → 11 Answer: find the blocking layer and prove it with a test
Five stages take you from "clicks counted, nothing opened" to the one layer that stops the tap, proven by a test.

1: What a tap does

2: The app around the page

3: See what happened

4: Change what the phone runs

5: Find the cause

Who this is for

  • Web or backend engineers who never debugged code inside a phone app
  • Anyone who ships JavaScript that runs inside other companies’ apps: ads, widgets, embedded checkouts

What you will take away

  • Which recorder proves which claim: the HAR for the network, the device log for the OS
  • How to change code that you do not own, on a phone that you cannot open DevTools on
  • A method to find the failing layer: one control per layer, and one test per guess

References


Start here: The Data Says Clicked, the User Says Nothing Happened.

↑↓ navigate ↵ open esc close