# Debugging Android app launch by setting debug app

DevFeed: [Debugging Android app launch by setting debug app](<https://devfeed.tech/articles/debugging-android-app-launch-by-setting-debug-app-25826.md>)

Original publisher: [Read original article](<https://segunfamisa.com/posts/android-debugging-set-debug-app>)

Author: Segun Famisa

Published: 2020-04-26T09:00:00Z

Content type: tutorial

Language: en

Sources: [Segun Famisa](<https://devfeed.tech/sources/segun-famisa.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>)

Tags: [adb](<https://devfeed.tech/tags/adb.md>), [android](<https://devfeed.tech/tags/android.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [commands](<https://devfeed.tech/tags/commands.md>), [debugger](<https://devfeed.tech/tags/debugger.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

This tutorial explains how to configure an Android application as the debug app so it waits for a debugger before launching. It covers using Android developer options and the set-debug-app adb command, including how to clear the setting and create command-line aliases.

## Source excerpt

Recently, I had to debug a deeplink problem that happens only on fresh app start-up. I was particularly interested in seeing what was happening at different parts of the app when the app starts up. Naturally, I put Log.d() statements allover the app, but it wasted a lot of my time. Every time I added a new log statement, I had to rebuild the app. In this short mini-blog, I'm going to share something I learned from a colleague - how to set a debug app and what it means. How can I set a debug app? A "debug app" is the app that you want to debug. When you set a debug app, the app is not launched until a debugger is attached. On launching the app, you see a dialog with "Waiting for Debugger" as its title. An example of the dialog is as shown in the screenshot below. By the time you see this dialog, you can (set break up points and) attach your debugger, then the app launch will resume. There are two ways you can set your debug app - via the developer options in your device settings or via an adb command. Setting debug app from developer options You can set the debug app and configure other options via the UI in developer options. To set it up: Navigate to Settings -> System -> Developer options and then scroll to the Debugging section. Click on "Select debug app". Select the application you want to debug from the list. Check the "Wait for debugger" option - this is what activates the behaviour we want where the debugged application waits for the debugger to attach before launching. The screenshots below show the step 2-4: And with that, you have set your app as the debug app. To clear the debug app, you can deselect your app by selecting the "Nothing" option when you get to step 3 above. Setting debug app from adb It is also possible to set the debug app from adb. I personally find this option quicker and more convenient than the other approach, but that's just me. The feature is available via the set-debug-app adb command. Typical usage is: adb shell am set-debug-app -