How to Use Your Own Android Device As an Emulator on Eclipse

As you develop applications on the Eclipse IDE, you will eventually run them to see if they work like they should. The first thing you will learn is that they will not work if there are errors, as signified by a red X by a line of code. Android has a tool known as DDMS (Dalvik Debug Monitor Server) that allows the user to debug on an actual device, instead of using the emulator on Eclipse.

An emulator is like the stage for which an application does rehearsals. I discuss in detail how to set up the emulator on Eclipse in Chapter 12. I have found that running an application on Eclipse and using the emulator on it can take many minutes of loading. In my experience, it’s much faster to plug in my own Android device. This way, whenever I run a program on Eclipse, it shows up on my Android device in seconds.

This is how to set up your Android tablet or smartphone for use as an emulator:

  1. Make certain that your phone or tablet is recognized by your computer. This means that the proper USB drivers for your Android device are installed and working on your laptop or desktop. For my Droid X phone, the Internet browser opens to a Verizon site every time I plug it in. Just because you can move files from your Android device to your computer doesn’t mean your computer recognizes your Android device. Chances are, it just sees a portable memory storage device, and wouldn’t know your Android device from a thumb drive. I found that my computer didn’t recognize my phone until I downloaded the proper drivers. I simple performed a Google search with Droid X drivers, and was able to find several places to download them.
  2. Open Eclipse and choose the Window Android SDK and AVD Manager. You’ll see the same screen shown in the last step of installing the Android SDK.
  3. Select Available Packages on the left side of the window.
  4. If you look at what is available, you will find the USB driver package in the Android repository. It will have Revision listed after it, along with the number of its current version. Select the USB driver package.
  5. Click Install Selected at the bottom right of the window.
  6. Accept the license and click Install.
  7. Close the program after it is done.
  8. Exit the Android SDK and AVD Manager.
  9. Go into your Android device and click Settings.
  10. On this Settings screen, select Applications.
  11. On the Application Settings screen, select Development.
  12. On the Development screen, check the “USB debugging” option.

Your phone and your computer should now be able to work together to build applications. You should see any application that you build in Eclipse run on your connected Android device.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.116.102