ska*_*eff 6 proxy android android-emulator android-networking
这是cmd行
"C:\Progra~2\Android\android-sdk\tools\emulator.exe" -avd Touch -netspeed full -netdelay none -http-proxy localhost:3128 -debug-proxy
Run Code Online (Sandbox Code Playgroud)
当我尝试从模拟器打开google.com时,这里是控制台:
server name 'localhost' resolved to 127.0.0.1:3128
proxy_http_setup: creating http proxy service connecting to: localhost:3128
server name 'localhost' resolved to 127.0.0.1:3128
proxy_http_setup: creating HTTP Proxy Service Footer is (len=2):
'
'
http_service_connect: trying to connect to (null)
http_service_connect: using HTTP rewriter
tcp:(null)(880): connecting
tcp:(null)(880): connected to http proxy, sending header
tcp:(null)(880): sending 27 bytes:
>> 43 4f 4e 4e 45 43 54 20 28 6e 75 6c 6c 29 20 48 CONNECT (null) H
>> 54 54 50 2f 31 2e 31 0d 0a 0d 0a TTP/1.1....
tcp:(null)(880): header sent, receiving first answer line
tcp:(null)(880): received 'HTTP/1.0 400 Bad Request'
tcp:(null)(880): connection refused, error=400
http_service_connect: trying to connect to (null)
http_service_connect: using HTTP rewriter
tcp:(null)(888): connecting
Run Code Online (Sandbox Code Playgroud)
以下是Wikitionary示例调试的例外情况
Caused by: java.net.ConnectException: en.wiktionary.org/91.198.174.232:80 - Connection refused
Run Code Online (Sandbox Code Playgroud)
关于我的代理:它是我本地机器上的鱿鱼,它被配置为通过父代理(使用auth)进行路由.这适用于浏览器/ Android SDK加载器/ IntelliJ等,但模拟器网络不起作用.
主要的混淆是
tcp:(null)
Run Code Online (Sandbox Code Playgroud)
有什么建议?
由于您是从 Android 模拟器引用系统上的 localhost,因此您必须使用http://10.0.2.2:8080/. 这是因为 android 模拟器在虚拟机内运行,因此,这里 127.0.0.1 或 localhost 将是模拟器自己的环回地址。此外,您不需要输入,-netspeed full -netdelay none因为属性默认设置为这些值。查看此内容以获取有关模拟器网络的更多信息。
编辑:
您可以localhost根据自己的情况替换为其他地址。如果它是路由器/网关地址,则将其替换为10.0.2.1。如果它是主机环回接口的特殊别名(即开发计算机上的 127.0.0.1),则将其替换为10.0.2.2. 如果它是第一个 DNS 服务器,则将其替换为10.0.2.3. 如果它是可选的第二个、第三个和第四个 DNS 服务器,则将其替换为10.0.2.4// 。如果它是模拟设备自己的网络/以太网接口,则将其替换为. 如果是模拟设备自己的环回接口,则将其替换为. 另外,开发计算机上的地址 127.0.0.1 对应于模拟器自己的环回接口,因此如果您想访问在开发计算机的环回接口上运行的服务,您应该使用特殊地址。单击此处了解有关此内容的更多信息。10.0.2.510.0.2.610.0.2.15127.0.0.110.0.2.2
| 归档时间: |
|
| 查看次数: |
4274 次 |
| 最近记录: |