求助:Android Studio 3.1及更早版本日志无法正常显示
Hey there, I’ve run into this exact log display issue multiple times across different Android Studio versions, so I feel your pain! Let’s walk through some proven fixes that should get your logs showing up properly again:
Double-check Logcat Filter Settings
The most common culprit is a misconfigured filter.- Make sure the "Show only selected application" dropdown is actually picking your app’s process (it should display your app’s package name). If it’s set to a different process or a custom filter that’s too strict, your logs will get hidden.
- Temporarily switch the log level to "Verbose"—sometimes higher levels like Info or Debug might exclude logs you’re expecting.
Restart Logcat (and Android Studio)
Don’t underestimate the power of a quick reset:- Click the circular arrow Restart button in the Logcat toolbar to refresh the log stream.
- If that doesn’t work, fully close Android Studio, kill any leftover
studio.exe/studio.shprocesses in your task manager, and restart the IDE. The Logcat daemon can get stuck and needs a fresh start.
Invalidate Caches and Restart
Corrupted cache files often cause weird IDE glitches:- Go to
File > Invalidate Caches... > Invalidate and Restart. This clears out stale data and forces Android Studio to rebuild its indexes, which frequently resolves log display issues.
- Go to
Reset ADB Connection
A flaky ADB link can block log transmission:- Open Android Studio’s Terminal and run these commands:
adb kill-server adb start-server - Run
adb devicesto confirm your emulator/device is listed and recognized. If not, reconnect the device or restart the emulator.
- Open Android Studio’s Terminal and run these commands:
Check Device/Emulator Log Restrictions
Some devices or emulators limit log output by default:- For emulators: Use the latest system image, and try wiping emulator data (
AVD Manager > Select your emulator > Wipe Data) to reset its state. - For physical devices: Go to
Settings > Developer Options > Debugging, ensure your app is selected as the "Select debug app", and enable "Disable adb authorization timeout" if you’re facing connection drops.
- For emulators: Use the latest system image, and try wiping emulator data (
Verify Your App’s Logging Code
Sometimes the issue isn’t with Android Studio—it’s with your logging implementation:- Double-check you’re using
Log.d(),Log.i(), etc., with valid tags and messages. AvoidLog.v()if your log level is set higher than Verbose. - If you’re using ProGuard/R8, add these rules to
proguard-rules.proto prevent log statements from being stripped:-keepclassmembers class * { public static android.util.Log *; }
- Double-check you’re using
Update Android Studio and SDK Tools
Outdated versions have known Logcat bugs:- Go to
Help > Check for Updates(Windows/Linux) orAndroid Studio > Check for Updates(macOS) to install the latest patches. - Also, update SDK Platform Tools via the SDK Manager—this fixes compatibility issues with newer devices/emulators.
- Go to
内容的提问来源于stack exchange,提问作者Imran Hakeem

