Debugging Deep Links and App Links in Android

leonov_dmitrii

Dmitrii Leonov

Posted on July 18, 2022

Debugging Deep Links and App Links in Android

Most of the time, it is quite simple to debug a deep link just run your app start attach debugger, and fire a deep link, it is straightforward and can be done without any adb command.

But what if you need to start an app with a deep link/app link? How do you attach the debugger then? Well, it's time for adb.

1. Run this command once, so that your app will be waiting for the debugger to be attached before starting it.

adb shell am set-debug-app -w --persistent <com.app.package>
Enter fullscreen mode Exit fullscreen mode

2. Trigger your deep link specifying activity that has an intent filter to recognize deep link sheme

adb shell am start -W -a android.intent.action.VIEW -d "<your-deep-link-url>" <com.app.package>.<your-activity-that-handle-intent>
Enter fullscreen mode Exit fullscreen mode

n. Once done, remove the effect applied by step #1

adb shell am clear-debug-app <com.app.package>
Enter fullscreen mode Exit fullscreen mode

More concrete example

adb shell am set-debug-app -w --persistent com.example.myapp

adb shell am start -W -a android.intent.action.VIEW -d "https://my-app-host-link.com/detail_screen_path?id=100" com.example.myapp.MainActivity

adb shell am clear-debug-app com.example.myapp
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
leonov_dmitrii
Dmitrii Leonov

Posted on July 18, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related