This guide walks you through testing Android deep links and intent filters, covering both the command-line tools and the Android Studio setup. You’ll learn how to verify that your app opens the correct screen for a given URL, test different URI schemes, and handle common pitfalls. Before you start, make sure you have Android Studio installed, a device or emulator running your app, and a basic understanding of your app’s manifest file.
What You’ll Need
- Android Studio (latest stable version recommended)
- A physical Android device with USB debugging enabled, or an Android emulator
- Your app project with the deep link intent filters already declared in
AndroidManifest.xml - Access to a terminal or command prompt (on Windows, use Command Prompt or PowerShell)
- ADB (Android Debug Bridge) – usually included with Android Studio’s platform-tools
Step-by-Step
- Verify your intent filters in the manifest. Open
AndroidManifest.xmland locate the<activity>that should handle the deep link. Ensure it has an<intent-filter>with<action android:name="android.intent.action.VIEW" />, a<category android:name="android.intent.category.DEFAULT" />, and<category android:name="android.intent.category.BROWSABLE" />. Also check the<data>tags for the correct scheme, host, and path. - Build and install your app. Run your app on the device or emulator from Android Studio (or use
gradle installDebug). Make sure the app is installed and the launcher activity is not in a weird state – a fresh install is best. - Open a terminal and locate ADB. ADB is usually in
~/Android/Sdk/platform-tools/on Linux/macOS or%LOCALAPPDATA%\Android\Sdk\platform-toolson Windows. Add it to your PATH or navigate to that folder in the terminal. - Test a basic deep link with ADB. Use the
am startcommand to simulate a tap on a URL. For example, if your deep link ishttps://example.com/path, run:adb shell am start -a android.intent.action.VIEW -d "https://example.com/path" your.package.name
Note: Replaceyour.package.namewith your actual application ID. If the intent filter is correct, your activity should launch. - Test with a custom scheme. If your app uses a custom scheme like
myapp://, run:adb shell am start -a android.intent.action.VIEW -d "myapp://host/path"
Again, watch the device to see if the correct screen opens. - Test from a browser (optional but recommended). On your device, open Chrome or another browser and type the deep link URL into the address bar. If the intent filter is set up correctly, a system dialog should appear asking which app to open it with (or it may open directly if your app is the only handler).
- Use Android Studio’s App Links Assistant. In Android Studio, go to Tools > App Links Assistant. It can help you generate the intent-filter XML, verify your setup, and even test the link by opening a URL on the connected device.
- Check the logcat output. If the deep link doesn’t work, open the Logcat window in Android Studio (View > Tool Windows > Logcat) and look for errors related to your activity or the intent. You can also add a
Log.dstatement in youronCreateto see if the activity is actually launched.
Common Mistakes
- Missing the BROWSABLE category. Without
android.intent.category.BROWSABLE, the link won’t work when tapped from a browser (though ADB may still trigger it). - Incorrect host or path. A typo in the host or path in the
<data>tag will cause the link to be ignored. Double-check the exact URL you’re testing. - Using a scheme that conflicts with another app. If another app also claims the same scheme, the system may show a chooser or open the wrong app. Use a unique scheme.
- Forgetting to rebuild after manifest changes. The manifest is read at install time, so if you change it, you must rebuild and reinstall the app.
- Testing with a URL that doesn’t match the filter exactly. Path matching is case-sensitive and can be tricky with wildcards. Use the exact path or test with the wildcard pattern you defined.
Tips
- Use the
--esflag to pass extra parameters to the intent, e.g.,adb shell am start -a android.intent.action.VIEW -d "https://example.com/path" --es "referrer" "utm_source=test". This helps test analytics or referral flows. - Test both the
httpsscheme and any custom scheme you support, as they behave slightly differently. - Use the
adb shell am start -Wflag to wait for the activity to launch and get a status output – useful for debugging. - If you have multiple activities with similar filters, specify the package name in the ADB command to avoid ambiguity.
- Use Android Studio’s Device File Explorer to verify that the installed APK has the correct manifest (look at
AndroidManifest.xmlin the APK).
Troubleshooting
- Nothing happens when you run the ADB command. First, check that the app is installed (use
adb shell pm list packages | grep your.package.name). Then verify the intent filter syntax in the manifest. Also try adding the package name to the command:adb shell am start -a android.intent.action.VIEW -d "https://example.com/path" your.package.name– this forces the intent to your app. - The app opens but the wrong screen appears. This usually means the intent filter matches, but your activity’s
onCreatedoesn’t parse the incoming intent correctly. Check thegetIntent().getData()method and extract the path and query parameters as needed. - You see a “No Activity found to handle Intent” error. This means no activity in your app (or any app) matches the URI. Double-check the scheme, host, and path. Also ensure the
VIEWaction andDEFAULTcategory are present. - The link works from ADB but not from a browser. This is almost always the missing
BROWSABLEcategory. Add it to your intent filter and reinstall. - Multiple apps handle the link and the chooser appears. This is normal if other apps claim the same URI. To test your app specifically, you can use the
--packageflag in ADB to target only your app:adb shell am start -a android.intent.action.VIEW -d "https://example.com/path" --package your.package.name. - The deep link works on emulator but not on a physical device. Ensure the device’s default browser is not intercepting the link in an unexpected way. Also check that the device’s Android version supports the URI scheme you’re using (custom schemes are generally fine).
Frequently Asked Questions
What is the difference between a deep link and an intent filter?
A deep link is a URL that points to specific content within your app. An intent filter is the declaration in your app’s manifest that tells the Android system which URLs your app can handle. The filter defines the scheme, host, and path patterns.
Can I test deep links without a physical device?
Yes, you can use an Android emulator. The steps are identical – just make sure the emulator has the app installed and that you use the correct ADB commands.
How do I test deep links that require authentication?
If your app requires login, you’ll need to be logged in on the device before testing. The deep link itself just launches the activity; the activity’s code handles the auth check.
Why does my deep link open the app but not the specific screen?
This usually means your activity’s onCreate is not reading the intent data correctly. Check that you call getIntent().getData() and parse the path/query parameters to navigate to the right fragment or screen.
Is it possible to test deep links in a unit test?
Yes, you can use Android’s testing framework to launch an activity with a specific intent and verify the result. However, for end-to-end validation of the intent filter, manual testing with ADB is more reliable.
What is the App Links Assistant in Android Studio?
It’s a tool that helps you add intent filters for your website URLs, verify that your app can handle them, and even generate the Digital Asset Links file for Android App Links. It also has a testing feature to open the URL on a connected device.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Create App Shortcuts in Windows 10 Start Menu
- How to Rename a SQL Server Database
- Fix Google Calendar Not Syncing on iPhone
- Fix Skype Microphone Not Working on Windows
- Google Docs Landscape: Change Page Orientation
- Recover Deleted Admin Account in Windows 11