Brejuro
Brejuro

Reputation: 3541

Logcat window clearing immediately on run

When I run my android app, the logcat window fills up and then clears. I have System.out.println()'s that aren't showing up, nothing is showing up and I have no idea why.

EDIT: Using Android Studio

Upvotes: 0

Views: 88

Answers (1)

TBridges42
TBridges42

Reputation: 1879

I have had a lot of issues with logcat in Android Studio, so here's a few items:

  1. In your run configuration (just to the left of the play button, select "Edit Configuration" from the drop-down, you can configure a couple of options related to logcat, including whether or not Android Studio will clear it on startup
  2. If the debugger disconnects you will lose your connection to the logcat. (some kinds of errors seem to force disconnect the debugger. I'm not entirely sure why.)
  3. If you never clear your logcat, then Android Studio will attempt to display the entire logcat since the last time you restarted the device/emulator. This can take a long time, and may display a blank screen while it's processing.
  4. By default, Android Studio will try to filter out messages unrelated to your app. In my experience, this never works right. I think it's easier to search for the tag that you're looking for.
  5. I haven't specifically tried System.out.println() in Android Studio, but the typical Android way to print debug messages is with Log.d. Log is located in android.util.Log. Android Studio will import it automatically if you type Log and press alt+enter.

My guess would be that your problem isn't that it's clearing logcat, but that it's not clearing logcat and Android Studio is choking on too large of a log file. Either select auto-clearing from the run configuration window or try walking away for a few minutes and see if the logcat ever comes back

Upvotes: 1

Related Questions