Android无法访问本地服务器(localhost)的解决方案
来源:互联网 发布:百度bae数据库 编辑:程序博客网 时间:2024/05/17 06:53
问题: 访问本地服务器,我们的第一想法是输入http://localhost:8080/test/index.html,可是这将不会成功,为什么呢?
原因:问题是这样的,android模拟器(simulator)把它自己作为了localhost,也就是说,代码中使用localhost或者127.0.0.1来访问,都是访问模拟器自己!这是不行的!
解决方案:如果你想在模拟器simulator上面访问你的电脑,那么就使用android内置的IP 10.0.2.2 吧, 10.0.2.2 是模拟器设置的特定ip,是你的电脑的别名alias记住,在模拟器上用10.0.2.2访问你的电脑本机.
- Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- 十七、Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost/127.0.0.1)的解决方案
- 十七、Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- Android无法访问本地服务器(localhost)的解决方案
- 十七、Android无法访问本地服务器(localhost)的解决方案
- Android访问本地服务器(localhost)的解决方案
- Android真机调试访问本地服务器(localhost)的解决方案
- 真机与Genymotion模拟器调试Android应用不能访问本地服务器(localhost)的解决方案
- Android真机 usb调试 访问本地服务器(localhost)的解决方案
- 安装IIS后无法访问本地服务器的解决方案
- KMP算法
- Javascript定时器的使用
- hbase
- android開機自動啟動
- 收集教育用书~
- Android无法访问本地服务器(localhost)的解决方案
- iOS开发者必备: 五大编程类工具
- Android——添加子视图(addview)
- mfc多线程创建,对话框关闭前退出进程
- ubuntu中安装oracle sun java.
- 跳台阶问题|斐波那契|递归
- android_jar包导入导出与使用
- WPF中的文字修饰——上划线,中划线,基线与下划线
- C++ 面试题 汇总