DEV Community

Dmitrii Leonov
Dmitrii Leonov

Posted on

2 1

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

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay