You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio 3.5.3调试Threads窗口反复刷新问题及jdb联用咨询

Hey there, let's work through your two issues one by one—first fixing that annoying Threads window that keeps looping "Collecting data" in Android Studio 3.5.3, then walking through exactly how to control your target device using jdb.

Fixing the Threads Window "Collecting Data" Loop in Android Studio 3.5.3

This is a common quirk in older AS versions, usually tied to unstable adb connections, corrupted cache data, or conflicting settings. Try these fixes in order:

  • Restart the adb server to refresh the device connection:
    Open your terminal/command prompt and run:

    adb kill-server
    adb start-server
    

    Reattach your debugger to the app and check the Threads window again.

  • Invalidate Android Studio caches and restart—this fixes most UI/debugging glitches caused by corrupted cache:
    Go to File > Invalidate Caches / Restart, select Invalidate and Restart, and let AS reload completely.

  • Disable Advanced Profiling (a frequent culprit in older AS versions):
    Open your run/debug configuration, navigate to the Profiling tab, uncheck Enable advanced profiling, then re-debug your app.

  • Update or roll back SDK Platform-Tools:
    Open the SDK Manager, go to the SDK Tools tab, check Show Package Details, then either update Platform-Tools to the latest version compatible with AS 3.5.3, or roll back to a known working version (try 29.0.6 if you’re on a newer release).

  • Test with a minimal debug app:
    Create a new empty Android project, run it in debug mode, and check the Threads window. If it works, the issue is specific to your original app—look for code that creates/destroys threads excessively, or conflicting debug flags in your build.gradle or AndroidManifest.xml.

  • Disable third-party plugins:
    Some third-party tools (like custom profiling or code analysis plugins) can interfere with the debugger. Go to File > Settings > Plugins, disable all non-Google plugins, restart AS, and test again.

Controlling Your Target Device with jdb

jdb is a reliable alternative when the AS debugger isn’t behaving. Here’s how to set it up and use it:

Prerequisites

  • Your device has USB debugging enabled (go to Settings > Developer Options > USB Debugging; if Developer Options is hidden, tap Build Number 7 times to unlock it).
  • Your app is a debug build (for Android 4.2+, debug builds automatically enable debuggability; for older versions, add android:debuggable="true" to your AndroidManifest.xml).

Step-by-Step Setup

  1. Get your app's process ID (PID)
    Run this command to list all debuggable processes on your device:

    adb jdwp
    

    Cross-check with adb shell ps | grep <your-app-package-name> if you need to confirm the correct PID.

  2. Forward a local port to the device's JDWP port
    Map a local port (we’ll use 8000 here) to your app’s JDWP port with adb:

    adb forward tcp:8000 jdwp:<your-app-pid>
    
  3. Launch jdb and attach to the port
    Start jdb and connect to your app with this command:

    jdb -attach localhost:8000
    

    You’ll see a confirmation once jdb connects successfully.

Common jdb Commands to Control Your App

Once connected, use these commands to debug (replace placeholders with your specific values):

  • threads: List all active threads (replaces the broken Threads window in AS)
  • suspend <thread-id>: Pause a specific thread
  • resume <thread-id>: Resume a paused thread
  • stop at com.yourpackage.YourClass:123: Set a breakpoint at line 123 of YourClass
  • print <variable-name>: Print the value of a variable in the current context
  • step: Execute the next line of code (step into methods)
  • next: Execute the next line of code (step over methods)
  • run: Resume execution of the entire app
  • quit: Exit jdb

内容的提问来源于stack exchange,提问作者Roney

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 10:39:11