How to view log messages on Android?

I am trying to debug an android app using log messages. When I use System.out.println and Log.i and run my android app, I don't see the debug message in the console or Logcat. If I need to get debug messages, I have to run Android application in debug mode

+3


source to share


4 answers


from eclipse goto window -> open perspective -> other -> select DDMS. And then launch the application. And then select your running device from DDMS. If the issue is not resolved, restart eclipse without closing the emulator, and then follow the same steps. Njoy,



+1


source


You don't need to run the application in debug mode to see the log messages.

To see the log messages you only need to enable usb debugging on your phone, adb drivers for your device, and a copy of Android developer tools. It looks like you have all of the above, so I'll suggest a few steps to fix this issue.

Don't use System.out.println

because it doesn't let you specify tag

. Make sure you set a good tag for your log messages. Once this is all confirmed, try to view the log message in eclipse logcat view mode. Create a filter with the tag you are using because many posts will print and it can be difficult to find yours. You can also filter the app using your app bundle name.

If you've tried all of this and you still can't see the log messages, try running:

adb kill-server

      

and



adb start-server

      

If you're out of luck, try restarting eclipse.

Confirm your device is connected!

If that doesn't work, you can also run ddms

from the sdk tools, which are a little more reliable.

Finally, if that doesn't work, you can simply issue adb logcat

on the command line. If you have multiple devices, you can list them with adb devices

and allow the device or emulator with -d for the only connected device

, -e for the emulator

or -s serialno

otherwise.

There are also tools that will allow you to view logs on your device, such as alogcat

+1


source


Someday you won't be able to choose an emulator

and another way is

restart your eclipse, i also faced this problem many times

0


source


If you are using Eclipse make sure:

  • You have debugging enabled on your device (or you are using an emulator),
  • The device is connected correctly - it should appear in the Devices view. If you don't have this view, select it from Window-> Show View-> Devices.
  • You have selected your device in the device window (just click on it),
  • You do not have a suspended LogCat and the filter is not enabled All messages (no filters)

    .
0


source







All Articles