Debugging Your Application on the Hardware


Build your own Android App Dev Empire

Get Instant Access

You mastered running applications in the emulator. Now let's put the application on real hardware. First, you must register your application as Debuggable in your AndroidManifest.xml file.To do this, perform the following steps:

1. Double-click the AndroidManifest.xml file.

2. Change to the Application tab.

3. Set the Debuggable Application Attribute to True.

4. Save the file.

You can also modify the application element of the AndroidManifest.xml file directly with the android:debuggable attribute, as shown here:

<application ... android:debuggable="true">

If you forget to set the debuggable attribute to true, the handset shows the dialog for waiting for the debugger to connect until you choose Force Close and update the manifest file.

Now, connect an Android device to your computer via USB and re-launch the Run Configuration or Debug Configuration of the application. Because you chose Manual mode for the configuration, you should now see a real Android device listed as an option in the Android Device Chooser (see Figure 3.17).

Figure 3.17 Android Device Chooser with USB-connected Android handset.

Choose the Android Device as your target, and you see that the My First Android App application gets loaded onto the Android handset and launched, just as before. Provided you have enabled the development debugging options on the handset, you can debug the application here as well.You can tell the handset is actively using a USB debugging connection, because there is a little Android bug-like icon in the notification bar. l_j A screenshot of the application running on a real handset is shown in Figure 3.18.

My Ffrst Android App

Hello World, MyFirstAndroidAppActiviEyJ

Figure 3.18 My First Android App running on Android device hardware.

Debugging on the handset is much the same as debugging on the emulator, but with a couple of exceptions.You cannot use the emulator controls to do things such as send an SMS or configure the location to the device, but you can perform real actions (true SMS, actual location data) instead.

Was this article helpful?

0 0
Easy Software Profits

Easy Software Profits

Here's How Anyone Can Start, Build and Run their Own Successful Software Empire Without Knowing the First Thing About Programming, Scripting Or Any 'Coder' Stuff. There is no doubt about it software sells. Software has a high percieved value and it solves problems for people.  A claim that can't always be made for PDF books, Video products and the like.

Get My Free Ebook

Post a comment