A link sent through a chat or email app can be changed before it reaches the device. With
adb shell am start you send the intent to Android's activity manager directly, so the
app receives exactly the URI you typed.
The basic command
The form used in the Android documentation:
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.example.android
This sends a VIEW intent for example://gizmos to the package
com.example.android and waits for the launch to finish. Replace the URI and the
package with your own. The ADB Command Generator builds the command from a form.
am start flags
The flags from the activity manager reference that matter for deep links:
-a <action>· the intent action. Deep links useandroid.intent.action.VIEW.-d · the data URI, which is your deep link.-c <category>· a category, such asandroid.intent.category.BROWSABLE.-n <component>· an explicit component, such ascom.example.app/.MainActivity.-eor--es <key> <value>· a string extra.--ezfor a boolean,--eifor an integer.-f <flags>· intent flags.-W· wait for the launch to complete and print the result.-S· force stop the app before starting the activity.--debug-link· on Android 17 and higher, prints how the system resolved the URL for App Links.
Example: a custom scheme
For myapp://product/42, let the system pick the app, as a tap would:
adb shell am start -W \ -a android.intent.action.VIEW \ -d "myapp://product/42"
If no activity matches, am prints
Error: Activity not started, unable to resolve Intent. To test the activity on its
own, name it with -n:
adb shell am start -W \ -a android.intent.action.VIEW \ -d "myapp://product/42" \ -n com.example.app/.ProductActivity
Example: an HTTPS App Link
Add the BROWSABLE category and leave out the package, so the system decides who
handles the link:
adb shell am start -W \ -a android.intent.action.VIEW \ -c android.intent.category.BROWSABLE \ -d "https://example.com/product/42"
If the domain is verified, your app opens. If the browser opens, see the
App Link troubleshooting guide. Naming the
package or the component with -n sends the intent to your app without verification,
which tests the activity while verification is still failing.
Extras
adb shell am start -W \ -a android.intent.action.VIEW \ -d "myapp://checkout" \ --es coupon "SUMMER" \ --ez guest true \ --ei step 2
Quoting URLs with & or spaces
Since Platform Tools 23, adb shell handles arguments the way ssh does.
Your local shell removes one level of quotes, and the device's shell reads the command again.
A URL in plain double quotes reaches the device unquoted, so an & in the query
splits the command there. Quote twice: single quotes around the whole command, double quotes
around the URL.
adb shell 'am start -W -a android.intent.action.VIEW -d "https://example.com/p?a=1&b=2"'
The Deep Link Tester and the ADB Command Generator quote the command this way for you.
Reading the output
With -W, am prints a status block. Status: ok means the
activity launched. Error: Activity not started, unable to resolve Intent means no
activity matched the action, scheme, host or path.
Warning: Activity not started, its current task has been brought to the front means
the activity was already running. To see what your app does with the intent, use
adb logcat. The Logcat Filter Builder limits the output to
your app.
More than one device
With more than one device or emulator connected, adb stops with
adb: more than one device/emulator. List the devices and pick one with
-s, which goes before shell:
adb devices adb -s emulator-5554 shell am start -W \ -a android.intent.action.VIEW \ -d "myapp://product/42"
Common questions
Why does am start say "unable to resolve Intent"?
No installed activity has an intent filter that matches the action, scheme, host and
path you passed. Check that the app is installed, the scheme is spelled the same way, and
the path fits the pathPrefix or pathPattern in the manifest. The
Intent-Filter Generator has a tester for this.
Can I test an iOS Universal Link with adb?
No. adb talks to Android only. The iOS equivalent is
xcrun simctl openurl booted "https://example.com/path" for the simulator.
For a real iPhone, open the link from a QR code with the Deep Link Tester.
Do I have to pass the package name?
No. Without it, the system resolves the link as a tap would. With the package or
-n, your app handles the URI even if verification or the app chooser would
send it elsewhere. That is useful for testing the activity on its own.
Keep reading
-
App Links vs Deep Links vs Universal Links
How the three link types differ and how each is verified.
-
When the link opens the browser
The causes and checks, in order.
Official docs
-
Android · adb and am
The activity manager command reference.
-
Android · Create deep links
Intent filters and the test command in context.