Sub topic 12
Testing Deep Links with `adb` and `simctl`
Assume you already configured a Flutter route, an Android App Link or custom scheme, and an iOS Universal Link or custom scheme. This chapter focuses on sending test links to running targets and diagnosing failures. You also need an Android emulator or device, an iOS simulator, and the correct Android application ID.
Test Android links with `adb`
adb is the Android Debug Bridge. Its am start command can send an Intent, which is Android's message for opening an activity or handling an action.
First, check that Android can see your target:
adb devicesThe device should appear with the state device. Then open an HTTPS link:
adb shell am start -W \
-a android.intent.action.VIEW \
-c android.intent.category.BROWSABLE \
-d "https://example.com/products/42?ref=adb" \
com.example.appReplace com.example.app with the value of applicationId in android/app/build.gradle or build.gradle.kts. The -W option waits for the launch to finish and reports timing information.
Test a custom scheme separately:
adb shell am start -W \
-a android.intent.action.VIEW \
-d "myapp://products/42?ref=adb" \
com.example.appIf Android opens a browser instead of your app, check the intent filter, host, path, and verified-link configuration. If the app opens but shows the wrong screen, inspect the URI received by Flutter and the router's path matching.
Test iOS links with `simctl`
simctl controls an iOS Simulator. Find available simulator devices with:
xcrun simctl list devicesBoot a simulator if necessary, then open an HTTPS URL:
xcrun simctl openurl booted \
"https://example.com/products/42?ref=simctl"The booted selector means the currently booted simulator. You can also provide a specific simulator identifier:
xcrun simctl openurl 8A1B2C3D-4E5F-6789-ABCD-0123456789AB \
"myapp://products/42?ref=simctl"A simulator does not always reproduce Universal Link behavior exactly as a physical device. Test the signed app on a real iPhone before release, especially after changing the Associated Domains entitlement or the apple-app-site-association file.
Test different launch states
A deep link can arrive when the app is closed, paused in the background, or already visible. Test each state:
| State | Test action | What to verify |
|---|---|---|
| Cold start | Stop the app, then open the link | Initial route uses the link |
| Warm start | Open the app, then send the link | Current navigation changes correctly |
| Background | Press Home, then send the link | App resumes at the target screen |
| Invalid link | Send an unknown path | A safe fallback appears |
Observe failures
Run Flutter logs while sending a link:
flutter logsOn Android, filter system messages when you need to inspect intent resolution:
adb logcat | grep -iE "ActivityTaskManager|Intent|flutter"Check these details in order:
- The scheme is correct:
httpsor your custom scheme. - The host and path match the platform configuration.
- The app receives the expected path and query.
- The router has a matching route.
- Authentication redirects preserve the original destination.
- Unknown paths produce a controlled error screen.
Exercise
Which command opens an HTTPS product link on the booted iOS Simulator?
Show answer
xcrun simctl openurl booted "https://example.com/products/42"