Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Help a newbie learn Eclipse/Android debugging best practices

Tags:

android

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

like image 469
AutoM8R Avatar asked Jul 25 '10 16:07

AutoM8R


1 Answers

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.

like image 190
nicholas.hauschild Avatar answered Sep 22 '22 16:09

nicholas.hauschild