简体   繁体   English

Android连接在本地主机上被拒绝

[英]Android Connection Refused on localhost

It's not a question but a help for everyone get Connection Refused in his Android application when access to a file on his localhost width adress like [http://127.0.0.1:8080] 这不是问题,而是对所有人的帮助,当访问其本地主机宽度地址(如[http://127.0.0.1:8080])中的文件时,Android应用程序中的连接被拒绝

Perhaps this could help anyone: 也许这可以帮助任何人:

If you want to access to a file on your computer width adt emulator, don't use the default ip [127.0.0.1] cause it's the ip of the device emulator. 如果要访问计算机宽度adt模拟器上的文件,请不要使用默认的ip [127.0.0.1],因为它是设备模拟器的ip。

Add a line on your apache configuration: listen *:8080, then use your computer adress in the httpget (for example HttpGet("[http://192.168.1.1:8080]") without []). 在您的apache配置上添加一行:监听*:8080,然后在httpget中使用您的计算机地址(例如,不带[]的HttpGet(“ [http://192.168.1.1:8080]”)。 You can find your IP adress when typing ipconfig in CMD console 在CMD控制台中键入ipconfig时,可以找到IP地址

Sorry for some langage errors, I hope you understand me ;-) Bye 抱歉,有些语言错误,希望您能理解;-)再见

or you can use the loopback ip 10.0.2.2 . 或者您可以使用回送ip 10.0.2.2 This is useful when you're working in a team and the other members have different IPs (--> Referring to localhost from the emulated environment ) 当您在团队中工作并且其他成员具有不同的IP时(-> 从仿真环境中引用localhost),这很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM