Pc ip address connected to Android Simulator

Source: Internet
Author: User

On the Internet, we can see that many basic tutorials use 127.0.0.1 as the IP address of the PC host when connecting the simulator to the PC host. In fact, this error occurs.If you use this address, it is like we usually use a PC to debug some WebProgramThe localhost is the same, but in the Android system, localhost points to the Android system. Therefore, when the address 127.0.0.1 is used for debugging, the host does not respond normally.According to my personal development experience, the correct IP address for PC host debugging on the android simulator should be: 10.0.2.2 Android 4.0 or above, which means the network cannot be connected in the main thread, and an error message will appear. Obtain the JSON data on the network in section 5.4 of the network programming book android4.0.CodeAndroid 4.0 and later versions cannot run, and listview cannot obtain data. After the program runs, the main interface is blank, and the program throws a network exception. Integer code = conn. getresponsecode (); all statements after this statement are not executed. This problem was discovered only after system. Out. println () was added. Think of the limit of 4.0. I used to know that the reason why I met myself was still half a day. The reading of this book has noticed that the above routine is correct on 2.3. Download routine code

Http://ishare.iask.sina.com.cn/f/33606153.html? From = DL

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.