Mobile: adb, Logcat & Xcode Simulator
Mobile bugs need evidence from the device itself: which build was installed, what the system log said when the app crashed, which deep link was opened, which permission was denied. On Android the tools are adb (Android Debug Bridge) and Logcat in Android Studio. On iOS they are the Xcode Simulator, its command-line twin simctl, and the macOS Console app for real devices. This chapter gives the exact setup steps and the commands testers use every day.
| Key fact | Android | iOS |
|---|---|---|
| Install | Android Studio, or only the SDK platform-tools (contains adb) | Xcode from the Mac App Store (macOS only) |
| Real device | USB or Wi-Fi debugging via Developer options | Connect to a Mac. Logs in the Console app |
| Logs | Logcat (Android Studio) or adb logcat | Console app, xcrun simctl spawn booted log stream |
| Emulator / simulator | Android Emulator (AVD Manager) | Simulator (Xcode → Open Developer Tool → Simulator) |
Identify the target (adb devices / simctl list) → clean state (pm clear / erase) → install the exact build → start log capture + screen recording → reproduce (deep link, push, location) → stop and pull files → attach: build number, device, OS version, steps, video, log excerptConnecting an Android device: Developer options, USB and wireless debugging
- On the phone, open Settings → About phone and tap Build number seven times until you see You are now a developer. On some vendors this is under Software information.
- Open Settings → System → Developer options and turn on USB debugging.
- Connect the phone by USB and accept the Allow USB debugging? prompt with the computer's RSA key fingerprint. Tick Always allow from this computer on your own test machine.
- On the computer run
adb devices -l. The device must show the statedevice.unauthorizedmeans the prompt wasn't accepted, andofflinemeans you should reconnect the cable. - Wireless (Android 11+): in Developer options turn on Wireless debugging → Pair device with pairing code, then run
adb pair IP:PORTwith the code shown, and finallyadb connect IP:PORT. The phone and computer must be on the same network.

adb devices -l # list targets with model and transport
adb -s emulator-5554 shell getprop ro.build.version.release # Android version of one target
export ANDROID_SERIAL=R58M12345XY # make one device the default for this terminalCaveat: With more than one device or emulator attached, adb fails with more than one device/emulator. Use-s SERIAL,-d(only USB device) or-e(only emulator).
adb commands QA uses daily: install, deep links, app data, screenshots, video
# Install / update / remove builds
adb install app-release.apk # fresh install
adb install -r app-release.apk # reinstall, keep data (upgrade test)
adb uninstall com.example.shop # remove app and data
# Clean state without reinstalling
adb shell pm clear com.example.shop # wipes app data and cache (like first launch)
adb shell am force-stop com.example.shop # kill the app
# Open screens directly
adb shell am start -a android.intent.action.VIEW -d "shop://orders/42"
adb shell am start -a android.intent.action.VIEW -d "https://shop.example.com/promo" # app link
# Permissions
adb shell pm grant com.example.shop android.permission.CAMERA
adb shell pm revoke com.example.shop android.permission.ACCESS_FINE_LOCATION
# Evidence
adb exec-out screencap -p > screen.png # screenshot straight to your PC
adb shell screenrecord --time-limit 60 /sdcard/bug.mp4 # Ctrl+C to stop earlier
adb pull /sdcard/bug.mp4 .
adb bugreport bugreport.zip # full system report for developers
# Device information for the bug report
adb shell getprop ro.product.model
adb shell dumpsys package com.example.shop | grep versionNameQA tip:pm clearplus a deep link reproduces "first launch from a marketing link" in seconds, which is a scenario that's slow to set up by hand. Text input for long fields isadb shell input text "hello%sworld"(%sis a space).
Logcat in Android Studio: filters, crashes and saved queries
- Run the app on the device or emulator, then open View → Tool Windows → Logcat.
- Choose the device in the dropdown at the top of the Logcat window.
- Type a query in the filter field. Press
Ctrl+Spaceto see suggestions. - Start with
package:mine, which means all packages of the open project. Then narrow it down:
package:mine level:ERROR
package:mine is:crash
package:mine (tag:OkHttp | tag:Retrofit)
package:com.example.shop -tag:Choreographer
package:mine message:"timeout" age:5m| Query | Meaning |
|---|---|
level:WARN | That level and higher (VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT) |
is:crash | Application crashes, Java or native |
is:stacktrace | Anything that looks like a stack trace |
tag: / -tag: | Include or exclude a tag |
tag~:Net.* | Regular expression match |
age:5m | Only the last 5 minutes |
- Click the star next to a query to save it as a favourite. Use Split Panels (right-click the log) to watch two queries or devices side by side.
- When the app process restarts after a crash, Logcat prints that the process ended and started again. The lines just before that are the crash.

Without Android Studio, use the command line:
adb logcat -c # clear old logs first
adb logcat -v time > logcat.txt # save everything with timestamps
adb logcat '*:E' # errors and above only
adb logcat -b crash # crash buffer only
adb logcat --pid=$(adb shell pidof -s com.example.shop) # only the running appXcode Simulator: devices, screenshots, location and appearance
- Open Xcode → Open Developer Tool → Simulator. Choose a device in File → Open Simulator (for example an older, smaller iPhone and the newest one).
- Install a test build by dragging the
.appbundle onto the Simulator window, or run it from Xcode. - Screenshots: File → Save Screen (
Cmd+S). Video: File → Record Screen. - Location: Features → Location → pick a preset such as City Run, or choose Custom Location… and enter coordinates.
- Appearance and accessibility: Features → Toggle Appearance (light/dark). Larger text is in the Simulator's Settings app → Accessibility → Display & Text Size.
- Device actions: Device → Rotate Left / Right, Device → Shake, Device → Home, and I/O → Keyboard → Toggle Software Keyboard.
- Reset when you need a clean device: Device → Erase All Content and Settings….
Caveat: The Simulator runs on your Mac's hardware and doesn't fully reproduce real-device behaviour: push notification delivery through APNs, camera, Bluetooth, real performance and memory pressure. Confirm device-specific bugs on a physical iPhone.
simctl from the terminal: deep links, push, permissions, status bar
xcrun simctl controls simulators from scripts. booted means "the simulator that is currently running".
xcrun simctl list devices # all simulators and their UDIDs
xcrun simctl boot "iPhone 16" # start a simulator by name
xcrun simctl install booted Shop.app
xcrun simctl launch booted com.example.shop
xcrun simctl openurl booted "shop://orders/42" # deep link / universal link
xcrun simctl push booted com.example.shop push.json # local push payload (no APNs)
xcrun simctl location booted set 50.4501,30.5234 # Kyiv
xcrun simctl privacy booted grant photos com.example.shop # or revoke / reset
xcrun simctl status_bar booted override --time 9:41 --batteryLevel 100 --cellularBars 4
xcrun simctl io booted screenshot shot.png
xcrun simctl io booted recordVideo bug.mp4 # Ctrl+C to stop
xcrun simctl keychain booted add-root-cert charles-root.pem # trust a proxy certificate
xcrun simctl erase all # factory-reset all (shut down) simulatorsAn example push.json for testing notification handling:
{
"aps": { "alert": { "title": "Order shipped", "body": "Order #42 is on its way" }, "badge": 1 },
"orderId": 42
}QA tip:status_bar overridegives clean, identical screenshots for visual comparisons and store listings. Clear it withxcrun simctl status_bar booted clear.
iOS logs: Console on macOS and simulator log stream
Real iPhone or iPad
- Connect the device to the Mac and trust the computer on the device.
- Open the Console app on the Mac and select the device under Devices in the sidebar.
- Click Start to stream messages. Use the search field to filter by process (your app's name) or by text, and Action → Include Info Messages / Include Debug Messages if you need more detail.
- Reproduce the bug, note the exact time, and look for errors and faults around that moment.
- Crash reports are in Xcode's Window → Devices and Simulators for the selected device, and in Settings → Privacy & Security → Analytics & Improvements → Analytics Data on the device itself.
Simulator
xcrun simctl spawn booted log stream --level debug \
--predicate 'process == "Shop"'Cheat sheet
| Task | Command or action |
|---|---|
| List Android targets | adb devices -l |
| Install / upgrade a build | adb install -r app.apk |
| Reset app to first launch | adb shell pm clear PACKAGE |
| Open a deep link (Android) | adb shell am start -a android.intent.action.VIEW -d "URI" |
| Screenshot / video (Android) | adb exec-out screencap -p > s.png / adb shell screenrecord |
| Only your app's errors | Logcat: package:mine level:ERROR |
| Crashes | Logcat: is:crash, CLI: adb logcat -b crash |
| Full report | adb bugreport bugreport.zip |
| Open a deep link (iOS Simulator) | xcrun simctl openurl booted "URI" |
| Fake push (iOS Simulator) | xcrun simctl push booted BUNDLE_ID push.json |
| Fake location | Simulator → Features → Location, or simctl location |
| Real iPhone logs | Console app → device → Start |
Summary
- Identify the exact device or simulator first (
adb devices -l,simctl list). Most "wrong device" mistakes start there. pm clear/erase, deep links, permission grants and fake locations or pushes let you reach any app state quickly and reproducibly.- Logcat queries such as
package:mine level:ERRORandis:crashturn a wall of logs into evidence. On iOS, use the Console app orlog stream. - Attach the build number, device, OS version, steps, a screen recording and a focused log excerpt to every mobile bug report.