How does Android run a real machine to debug applications on Eclipse?

Source: Internet
Author: User

Perform the following steps:

1. Connect your mobile phone to your computer through a data cable

2. Set the Android phone to USB debugging mode. Step: Choose menu> Settings> Application> development and select USB debugging]

3. If Windows is used, the system will prompt you to install the driver:

Select the correct android SDK installation directory and click Next. The system will start to install the driver.

4. After the driver is installed, restart the computer (the system usually prompts "install a new driver and restart it to take effect ").

5. Repeat steps 1st and 2nd to open the command window and check whether the mobile phone device has been identified, as shown below:

"Ht99ylg11834 device" is the detected mobile phone device.

6. Next, debug the android program on Eclipse. Right-click the android project and choose run as> Android Application. The following window is displayed: (this effect can be achieved after the system is restarted)

7. Select the mobile phone device, click OK, and the program will start to be installed on the real machine. The console outputs the following information:

[22:24:49-helloworld] uploading helloworld.apk onto device 'ht99ylg11834 ′
[22:24:49-helloworld] installing helloworld.apk...
[22:24:53-helloworld] success!
[22:24:53-helloworld] Starting activity com. eightqiu. activity. statsresultactivity on Device
[22:24:57-helloworld] activitymanager: Starting: intent {act = android. intent. action. main cat = [android. intent. category. launcher] CMP = com. eightqiu. activity /. statsresultactivity}

8. Set the application to debug mode. Operation: Edit androidmanifest. XML to add the debugging parameter Android: debuggable = "true", as shown below:

<Application Android: icon = "@ drawable/icon" Android: Label = "@ string/app_name" Android: debuggable = "true">

9. Execute the real machine debugging operation: In the eclipse debugging dialog box, select manual in the target window, click the debug button, and select the real machine device to start debugging.

Note: whether or not the eclipse environment is enabled, any Android software can view the exception information in the command line window as long as an exception occurs on the real machine:

Run:./ADB logcat to view more system exception messages. In these messages, check the caused by: header line, which specifies the line of code error

10. Run this application so that you can use your mobile phone to test it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.