android - 需要有关 Android 模拟器网络的帮助

标签 android proxy android-emulator android-networking

这是命令行

"C:\Progra~2\Android\android-sdk\tools\emulator.exe" -avd Touch -netspeed full -netdelay none -http-proxy localhost:3128 -debug-proxy

这是我尝试从模拟器打开 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

这是维基百科示例调试的异常

Caused by: java.net.ConnectException: en.wiktionary.org/91.198.174.232:80 - Connection refused

关于我的代理:它是我本地机器上的 squid,它被配置为通过父代理(使用身份验证)进行路由。这适用于浏览器/Android SDK 加载器/IntelliJ 等,但模拟器网络不起作用。

主要的困惑是

tcp:(null)

有什么建议吗?

最佳答案

模拟器中的代理支持存在大量已记录的问题,尤其是对于 Windows 上的最新版本。请在此处查看错误报告:

http://code.google.com/p/android/issues/detail?id=5508&q=emulator%20proxy&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

其中有一些建议的解决方法可能会有所帮助,例如在网络设置中设置代理而不是为整个模拟器设置代理。

关于android - 需要有关 Android 模拟器网络的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6775743/

相关文章:

java - 代理仅忽略 httpS 请求的身份验证 header

java - SSL 通信中的 Apache CXF 异常 : SocketTimeOut

php - 在 PHP 中创建一个代理来欺骗 iPhone 用户代理?

Android Studio 模拟器首次出现互联网连接问题

android - 如何在android模拟器中将可读权限更改为可写权限

android - 如何取消组合 Fabric 中的 native 崩溃报告?

java - 如何使用 Dagger 2 注入(inject) pojo 依赖项?

java - 无法禁用 EditText 且分数变量不更新

android - Fresco - 来自 ControllerListener 的 onIntermediateImageSet 未被调用

android - Xamarin 函数错误