In this tutorial, we will use the following tools on the Windows 64-bit platform:
JDK1.7
Eclipse 4.2 Juno
Sony Xperia Tipo
In order to debug and run applications on real devices, the following steps are generally required:
If you are using an Android development phone (ADP), such as Nexus One or Nexus S, download Google's USB drive.
If you are using other Android devices, such as Sony, LG, HTC, then download the corresponding OEM USB driver.
Turn on USB debugging on the phone.
Connect the device to the computer.
Use the Adb.exe Devices command to confirm that the device has successfully connected.
Set Eclipse to manually select the target device that is running the application.
1. Download USB Driver
If you are using an Android development phone (ADP) device, you only need to open the Android SDK manager and install Google's USB driver.
If you are using other Android devices, download your device drivers according to the official Android USB driver guide.
As mentioned earlier, I will use Sony's Xperia Tipo. If you are using a Sony device, you can find the appropriate driver on the Sony mobile page. In my case, when a mobile phone is plugged into a computer, it prompts for the need to install a Sony PC companion.
This will connect all the phones to the computer's required drivers, including USB drivers for Android debugging. I think this should be the most modern smartphone case. If you encounter any problems, you can always access the manufacturer's Web page to download the driver. After you install the driver, you may need to restart your computer.
2. Enable USB debugging on the device
To run Android apps on a real device, you need to turn on USB debugging on your phone.
Enter the settings
"Developer Options"
"USB Debugging".
3. Connect the device to the computer
In this step, you must connect your phone to your PC and confirm that it is properly recognized by the system. If this step works correctly, this means that the USB driver is working properly.
If your phone is connected, open the command prompt and go to the installation folder of the Android SDK and enter the Platform-tools directory. There are a lot of Android command-line tools in this folder.
Paste the following command:
1adb.exe devices
As you can see in the figure above, the device was successfully connected and assigned ID bx903dmu63. That's great!
4. Eclipse Development Settings
If you've been developing Android apps for a while, you may have been using the Android simulator. The default setting in Eclipse is to deploy the application on the Android virtual device. So we're going to configure it to allow manual selection, and we want the application to run on a manually selected device. One of the options must be our real device.
In Eclipse, select Run-> run configuration. Then select the Android project you want to run from the list on the left. Click the Target tab. Select the option "Always prompt for device selection". Alternatively, you can select "Start all compatible device/AVD." This option will run your project at the same time on all available Android devices, including emulators and real-world devices.
In this tutorial I will use an existing Android project in a workspace that is an example of a simple Android progress bar.
5. Running the project
Now, when you run the Android project, you will be prompted to select a device. Select Select a running Android device, and then select your own device.
Now let's see what our application looks like on a real device. This is the main screen:
When we light the button:
That's it!
This is the Android tutorial on how to debug applications on Android real-world devices.