tags:

views:

89

answers:

2

Hello all, I am a newbie to Android and the Eclipse development environment and would like some advice on best practices for debugging my apps when they throw a Force Close.

I have researched ADB, however, I can not get this to interact with my phone even though I have explicitly turned debug mode to true on my test handset.

Obviously Android comes with a LOG method which I have seen utilized in many example apps, can someone please explain how to review these logs quickly and how to setup logging appropriately to determine the cause of a Force Close (always occurs when I push the Home button).

Any advice on debugging effectively in Eclipse would be much appreciated!

Sincerely, Ryan

A: 

To debug using your device, you will need to have debug mode turned on (which it sounds like you do), you will then need to have the phone plugged in with the USB connector. From here, you can tell Eclipse to run/debug.

Eclipse should ask which device to use (this is done because there should be multiple devices available for running/debugging since your device is plugged in). At this point, you can select your actual device from the list, and you should be up and running.

If you are using android.util.Log, then your logs will show up in LogCat. If you do not see LogCat by default in your Eclipse environment, you can add it by doing the following:

Go to Window -> Show View -> Other
Select Android -> LogCat
Cick OK.

When running/debugging your device, you should see your Log statments in LogCat.

nicholas.hauschild
Awesome, that is exactly what I was wondering. I will try ADB again, if it doesn't work checking Logs in Eclipse sounds very easy (I need an efficient method instead of browsing to a source file each time, this sounds like it does the job!).
AutoM8R
A: 

As I have never been able to get Eclipse to refresh the LogCat when I'm debugging on device, I will add this :
You can also debug from command line like this : "adb -d logcat"
However, as the windows command line is awfully basic, the line are cut in 2 most of the time.
And my asking about your OS does help because the procedure is not the same to set up device debugging if you are on windows or linux or mac.
For instance, in the case of windows, you need to install a driver (you can find all the doc here) before being able to debug on a device.

Sephy