android-studio - android localhost连接?
本文介绍了android-studio - android localhost连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
一直无法连接显示:java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 8000) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused),
权限user-pression加了。
private static final String BASE_URL = "http://10.0.2.2:8000/";也修改了,
解决方案
你要连接什么?10.0.2.2地址为A类IP地址,许多情况下跟127.0.0.1是一样的,指向本机(这里指的是你的调试机器),你的本机有服务吗?
这篇关于android-studio - android localhost连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文