且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

org.apache.http.conn.HttpHostConnectException:连接到http:// localhost在android中拒绝

更新时间:2022-06-05 15:58:37

如果你使用模拟器运行你的应用程序的本地服务器。将本地 ip 标记为 10.0.2.2 ,并且必须为您的应用授予互联网权限:

if you are using emulator to run your app for local server. mention the local ipas 10.0.2.2 and have to give Internet permission into your app :

<uses-permission  android:name="android.permission.INTERNET" />