How do I monitor network traffic sent and received from my android emulator?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You can monitor network traffic from Android Studio. Go to Android Monitor and open Network tab.
http://developer.android.com/tools/debugging/ddms.html
UPDATE: ⚠️ Android Device Monitor was deprecated in Android Studio 3.1. See more in https://developer.android.com/studio/profile/monitor
It is also possible to use http proxy to monitor http requests from emulator. You can pass
-http-proxy
flag when starting a new emulator to set proxy (Example burp) to monitor Android traffic. Example usage./emulator -http-proxy localhost:8080 -avd android2.2
. Note that in my example I'm using Burp, and it is listening port 8080. More info can be found here.For OS X you can use Charles, it's simple and easy to use.
For more information, please have a look at Android Emulator and Charles Proxy blog post.
You can start the emulator with the command
-avd Adfmf -http-proxy http://SYSTEM_IP:PORT
. I used HTTP Analyzer, but it should work for anything else. More details can be found here: http://stick2code.blogspot.in/2014/04/intercept-http-requests-sent-from-app.htmlYou can use http://docs.mitmproxy.org/en/stable/install.html
Its easy to setup and won't require any extra tweaks.
I go through various tool but found it to be really good and easy.
There are two ways to capture network traffic directly from an Android emulator:
Copy and run an ARM-compatible tcpdump binary on the emulator, writing output to the SD card, perhaps (e.g.
tcpdump -s0 -w /sdcard/emulator.cap
).Run
emulator -tcpdump emulator.cap -avd my_avd
to write all the emulator's traffic to a local file on your PCIn both cases you can then analyse the pcap file with tcpdump or Wireshark as normal.