WebViewer
WebViewer

Reputation: 831

LogCat displaying messages as one single long string (no linebreaks)

Upon connecting my Android device (Redmi 6A, running Android 8.1) via USB debugging, LogCat displays all messages in a single line, instead of displaying each message in its own line:

LogCat screenshot

Any idea why this is happening and how to fix this?

(several posts I found in stackoverflow.com complain about the opposite, i.e. "how to join several lines", not what I am experiencing here)

Upvotes: 1

Views: 740

Answers (3)

Ivo Andonov
Ivo Andonov

Reputation: 81

The problem is that the latest available ADT plugin for eclipse splits logcat lines by "\r\n" while it is necessary to split them by "\n". This is handled by the com.android.ddmlib.MultiLineReceiver class.

If one still wants to have the logcat integrated into eclipse, then the solution is to replace this class file with the one from the mentioned in other answers monitor that works.

The class file is in ddmlib.jar file. Look for this file in your eclipse installation folder. Then find the same file in the monitor folder. They are in relatively similar relative paths - something like "configuration\org.eclipse.osgi\bundles\xxx\1.cp\libs". Close eclipse (if running). Open both jars as zip files (using 7-zip for example) and copy com\android\ddmlib\MultiLineReceiver.class from the monitor found jar to the eclipse found jar. Start eclipse and happy logcatting.

Note: the org.eclipse.osgi folder is some cache folder. The ddmlib.jar that is automatically copied there is in the plugins\com.android.ide.eclipse.ddms_23.0.7.2120684.jar file libs (zip) sub folder (cited version is from my install that I assume is the latest available for eclipse). So one can patch this jar with the modified ddmlib.jar if the cached folder happens to get cleared some day.

Upvotes: 1

WebViewer
WebViewer

Reputation: 831

Actually, there is a solution that is better than the command line adb logcat (without having to install Android Studio): It is called "Android Device Monitor' and it is invoked by C:\adt-bundle-windows-x86_64\sdk\tools> monitor.bat:

screenshot of working GUI based LogCat

Credit goes to https://stackoverflow.com/a/19169081/2597758

Upvotes: 0

WarrenFaith
WarrenFaith

Reputation: 57702

One of two things you can do:

  • use logcat from command line
  • run Android Studio in parallel to get the logcat output there

Upvotes: 1

Related Questions