1.模拟器ip默认为10.0.0.15,本地pc机默认ip10.0.2.2.
2.设置模拟器通过本地pc机作为代理上网。用eclispe启动模拟器前在runConfig里target设置代理参数:-http-proxy 10.0.2.2:8888。
3.fiddler工具抓包工具的端口是8888.
4.在android应用中添加代码:
HttpURLConnection connection = null ;
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "10.0.2.2");
System.getProperties().put("proxyPort", "8888");
。。。。
connection.connect();
5.发送请求就可以通过fiddler看到了。