AndroidMedium

Master Android Debugging: From ADB to Android Studio

This guide will introduce you to the essential tools and techniques for debugging Android applications. You'll learn how to set up your environment, use ADB, analyze logs in Logcat, and work with the Android Studio debugger.

Updated at February 16, 2026
20-40 min
Medium
FixPedia Team
Применимо к:Android 5.0+Android Studio Arctic Fox (2020.3.1)+ADB 1.0.41+

Introduction / Why This Is Needed

Debugging is a key stage in Android app development. Without effective use of debugging tools, finding and fixing errors becomes a chaotic process that consumes hours. This guide will give you a systematic understanding of the essential tools: ADB, Logcat, and Android Studio's built-in debugger. You'll be able to quickly find causes of crashes, analyze data flow, and test code in real-world conditions on a device.

Requirements / Preparation

Before you begin, ensure you have the following installed:

  1. Android Studio (version Arctic Fox 2020.3.1 or newer) with Android SDK and Android SDK Platform-Tools components.
  2. An Android device (version 5.0 and higher) with "USB debugging" enabled (found in Settings → Developer options).
  3. A USB cable (preferably a high-quality one that supports data transfer).
  4. For Windows: installed USB drivers for your device. For Linux: configured udev rules.
  5. Basic knowledge of working with a terminal/command line.

Step 1: Enable USB Debugging on the Device

On the device itself, you need to activate developer mode and allow debugging.

  1. Go to Settings → About phone.
  2. Find the "Build number" item and tap it 7 times. A notification "You are now a developer!" will appear.
  3. Go back to the main settings menu and find the new "Developer options" (or "For developers") section.
  4. Inside, enable the "USB debugging" toggle.

⚠️ Important: When connecting the device to the computer for the first time, a dialog will appear asking "Allow USB debugging?". Be sure to check "Always allow from this computer" and click "OK".

Step 2: Prepare the Computer: Install Drivers/Rules

Without the correct drivers, the computer will not see the device.

For Windows:

  1. Download the drivers:
    • Universal: Google USB Driver (via Android Studio's SDK Manager).
    • Manufacturer-specific: Drivers from the Samsung (Kies), Xiaomi (Mi PC Suite), Huawei, etc. websites.
  2. Install the driver via Device Manager (Win + R → devmgmt.msc).
  3. Find the unknown device (usually with a yellow exclamation mark) under "Other devices" or "Android Device".
  4. Right-click → "Update driver""Browse my computer for driver software" → point to the folder with the extracted driver.

For Linux (Ubuntu/Debian):

  1. Create the rules file:
    sudo gedit /etc/udev/rules.d/51-android.rules
    
  2. Paste the rules for your manufacturer. For example, for general Google devices:
    SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
    
    Full list of vendor IDs: https://developer.android.com/studio/run/linux-usb
  3. Set permissions and reload udev:
    sudo chmod a+r /etc/udev/rules.d/51-android.rules
    sudo udevadm control --reload-rules
    sudo udevadm trigger
    

Step 3: Check Device Connection via ADB

Now you need to confirm the connection is established.

  1. Open a terminal (Linux/macOS) or Command Prompt/PowerShell (Windows).
  2. Navigate to the platform-tools folder (usually ~/Library/Android/sdk/platform-tools/ on macOS or C:\Users\<User>\AppData\Local\Android\Sdk\platform-tools\ on Windows) or add it to your PATH.
  3. Run the command:
    adb devices
    
  4. Expected output:
    List of devices attached
    0123456789ABCDEF    device
    
    If it says unauthorized instead of device, check the dialog on the device. If the device is not listed — return to Step 2.

Step 4: Configure the Project in Android Studio

  1. Open your project in Android Studio.
  2. Ensure the build.gradle file (module level) specifies the correct compileSdk and minSdk versions.
  3. On the toolbar at the top right, find the "Select Deployment Target" dropdown.
  4. In the window that opens, your device should appear under "Connected Devices". Select it and click "OK".
  5. To debug, click the "Debug" button (bug icon). The app will install and launch in debug mode.

Step 5: Use Logcat to Analyze Logs

Logcat is your primary source of information about what's happening in the system and your app.

  1. In Android Studio, open View → Tool Windows → Logcat.
  2. At the top of the Logcat window, select:
    • Device: your connected device.
    • Process: your app's process (usually com.example.yourapp). You can select <your_package_name> or No Filters for all.
    • Log level: set to Debug or Verbose for maximum detail, Error for errors only.
  3. To quickly find your app's logs, use a filter:
    • By tag: enter tag:MyAppTag (if you use a specific tag in code).
    • By package: enter package:com.example.yourapp.
  4. Look for lines with E/ (Error), W/ (Warn), or AndroidRuntime (for unhandled exceptions). Click on an error line — Android Studio will jump to the corresponding line of code (if sources are available).

Step 6: Run the App in Debug Mode

This is the main method for step-by-step analysis.

  1. In the code editor, set breakpoints: click in the gray area to the left of the line number where you want execution to stop (a red circle will appear).
  2. Click the "Debug" button (bug icon) on the toolbar.
  3. The app will launch on the device. Once execution reaches a breakpoint, it will pause.
  4. The debugger window will appear at the bottom:
    • Frames: call stack.
    • Variables: current variable values in context.
    • Watches: add an expression to monitor.
  5. Use the execution control buttons:
    • Resume (F9): continue to the next breakpoint.
    • Step Over (F8): execute the current line and move to the next.
    • Step Into (F7): step into the method called on the current line.
    • Step Out (Shift+F8): step out of the current method.
  6. You can change variable values directly in the debugger to test different scenarios.

Verification

After completing the steps, you should be able to:

  1. See your device in the adb devices list.
  2. Successfully launch the app on the device from Android Studio.
  3. See your app's logs in Logcat, filtered by package.
  4. When breakpoints are set — pause code execution and inspect variable states.

If all points are working — the debugging environment is set up correctly.

Possible Issues

Issue: Device does not appear in adb devices or in Android Studio.

Solution:

  • Reconnect the USB cable, try a different port.
  • On the device, go to Settings → Developer options and turn "USB debugging" off and on.
  • Restart the adb server:
    adb kill-server
    adb start-server
    adb devices
    
  • For Windows: check in Device Manager that the device is recognized as "Android Composite ADB Interface" without errors. Update the driver manually.

Issue: No logs from my app appear in Logcat.

Solution:

  • Ensure you are using Log.d(tag, message) or similar in your code, not System.out.println.
  • Check the Logcat filter: set the level to Debug or Verbose, try clearing the filter (No Filters).
  • Ensure the app is running on the same device selected in Logcat.
  • On some devices (especially MIUI), you additionally need to enable "Enable USB debugging (Security settings)" in Developer options.

Issue: Breakpoints are ignored, the app does not stop.

Solution:

  • Ensure you launched the app via "Debug", not "Run" (the bug icon).
  • Check that the breakpoint is active (red circle, not a gray circle with an outline). Gray means the code will not be loaded (e.g., a breakpoint in an unused class).
  • Clean the project (Build → Clean Project) and restart the debug session.
  • If the app is already running, stop it completely and launch it again in debug mode.

F.A.Q.

What is ADB and why is it needed for debugging?
How to view application logs in Logcat?
Why is my device not showing up in the `adb devices` list?
How to set up debugging over Wi-Fi instead of a USB cable?

Hints

Enable USB debugging on the device
Prepare your computer: install drivers/rules
Check device connection via ADB
Set up the project in Android Studio
Use Logcat for log analysis
Run the application in debug mode
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community