Android无法访问本地服务器(localhost/127.0.0.1)的解决方案
【Android无法访问本地服务器(localhost/127.0.0.1)的解决方案】
在Android开发中通过localhost或127.0.0.1访问本地服务器时,会报Java.NET.ConnectException: localhost/127.0.0.1:8083 -Connection refused异常。
为什么会报这个异常呢?因为Android模拟器本身把自己当做了localhost或127.0.0.1,而此时我们又通过localhost或127.0.0.1访问本地服务器,所以会抛出异常了。
在在模拟器上可以用10.0.2.2代替127.0.0.1和localhost;
参考:http://blog.csdn.net/surehao/article/details/23460123
Android无法访问本地服务器(localhost/127.0.0.1)的解决方案的更多相关文章
- Android无法访问本地服务器(localhost)的解决方案
在Android开发中通过localhost或127.0.0.1访问本地服务器时,会报java.net.ConnectException: localhost/127.0.0.1:8083 -Conn ...
- Android模拟器访问本地的localhost失败及解决方案
在开发手机网站是,使用Android模拟器测试,在手机浏览器中输入localhost访问本地服务器失败! 原因: 在Android系统中localhost就是127.0.0.1 在Windows系统中 ...
- Android 虚拟机访问本地服务器的地址
http://10.0.2.2:8080/test/ 比如 localhost:8080 为 tomcat 地址,然后 test 是 tomcat 目录下 webapps 的子目录. 10.0.2.2 ...
- 不能访问本地服务器场。没有注册带有FeatureDependencyId 的 Cmdlet
不能访问本地服务器场.没有注册带有FeatureDependencyId 的 Cmdlet. 原因: 我有两个域管理员账号,分别:sp\administrator,sp\spadmin 其中后者才 ...
- 如何改变服务器的本地域名来访问本地服务器 而不用localhost或者127.0.0.1来访问
1. vim nginx.conf 如下: server { listen 80; server_name pma; ...
- android模拟器没法通过localhost访问本地服务器的解决
当android项目访问在一台服务器上的WEB服务时,没法通过localhost或者127.0.0.1来访问.模拟器把它自己作为了localhost,代码中使用localhost或者127.0.0.1 ...
- Android真机调试访问本地服务器(localhost)的解决方案
Android系统把它自己作为了localhost!当连接localhost都是他自己啊.. 囧,在这里晕了好久才发现.. 网上介绍的都是模拟器连接本地服务器的,我试着把链接改为http://10.0 ...
- ANDROID模拟器访问本地WEB应用10.0.2.2
在一般的Java Web程序开发中,我们通常使用localhost或者127.0.0.1来访问本机的Web服务,但是如果我们在Android模拟器中也采用同样的地址来访问,Android模拟器将无法正 ...
- 【android】java.net.ConnectException: localhost/127.0.0.1:8080 - Connection refused
调试中通过android simulator模拟器链接localhost或者127.0.0.1,因为我在电脑上面建立了apache,我的代码大概就是URL url = new URL(urlStrin ...
随机推荐
- js语法规则 ---console.log ---- prompt ----基本类型 ---parseInt
在页面中可以在body里面加入type=”text/javascript” 例如: <script type="text/javascript"> </scrip ...
- fabric默认样例的分析
参考资料 http://www.bubuko.com/infodetail-2092748.html http://www.ithao123.cn/content-11117437.html http ...
- ORA-00257: archiver error. Connect internal only, until freed【日志归档清理】
select * from V$FLASH_RECOVERY_AREA_USAGE; 查看使用情况 用plsql登陆时提示“ORA-00257: archiver error. Connect in ...
- JMeter做http接口功能测试
1. 普通的以key-value传参的get请求 e.g. 获取用户信息 添加http请求:填写服务器域名或IP:方法选GET:填写路径:添加参数:运行并查看结果. 2. 以Json串传参的post请 ...
- 【ASP.NET 插件】分享一款富文本web编辑器UEditor
UEditor是由百度web前端研发部开发所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码... <%@ Page Language ...
- springboot 停止
因springboot内嵌tomcat或jetty使得我们没法去操作服务: 因此,常常是服务起来后,要重启时会端口占用,我们只能无情的kill掉端口. 不过spring也设置有配置停止的请求: App ...
- Redis入门高级部分
Redis: redis批量删除 redis数据备份和恢复 redis安全 redis性能测试 Redis 客户端连接 redis管道技术 redis分区 java操作redis redis批量删除 ...
- Oracle函数使用
数据格式化截取: Trunc(data,[yyyy]) oracle的特有if判断: decode(sex, 0, '男', 1, '女') 分组排序:row_number() over(parti ...
- Others-常用数学符号大全
常用数学符号读法大全 大写 小写 英文注音 国际音标注音 中文注音 Α α alpha alfa 阿耳法 Β β beta beta 贝塔 Γ γ gamma gamma 伽马 Δ δ deta de ...
- leetcode 错误题解,反面教材 Gas Station
class Solution { public: int canCompleteCircuit(vector<int>& gas, vector<int>& c ...