16.11.2015 Views

PG2

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

42 Chapter 2 PhoneGap Development, Testing, and Debugging<br />

Figure 2-10 ​ ​Eclipse messages area<br />

This pane will display all messages generated by the Android device emulator as<br />

well as console messages written by your PhoneGap application; you can see the<br />

three messages written by the sample application. Use the V (verbose), D (debug),<br />

I (info), W (warning), and E (error) buttons at the top of the pane to filter the contents<br />

of the pane as needed to allow you to more quickly locate the entries you are<br />

looking for while debugging an application.<br />

Google also offers a stand-alone utility called the Dalvik Debug Monitor Server<br />

(DDMS) that you can use to monitor the Android emulator console when testing<br />

PhoneGap applications outside of the Eclipse IDE. To launch the DDMS utility,<br />

you must first launch an Android emulator. Once the emulator is running, open a<br />

file explorer (Finder on Macintosh or Windows Explorer on Windows), navigate<br />

to the Android SDK tools folder, and execute the DDMS utility located therein.<br />

The file is called ddms.bat on Microsoft Windows and ddms on Macintosh.<br />

When the utility launches, it will display a window similar to the one shown in<br />

Figure 2-11. At the top of the utility are windows that show the different processes<br />

running in the emulator on the left and a list of additional options on the right. The<br />

lower half of the application’s window displays the same LogCat pane from the<br />

Eclipse plug-in.<br />

To access the LogCat content from the command line on Windows, open a command<br />

prompt, navigate to the Android SDK platform-tools folder, and issue the<br />

following command:<br />

adb logcat<br />

On Macintosh, open a terminal window, navigate to the Android SDK platformtools<br />

folder, and issue the following command:<br />

./adb logcat

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!