Proxyman으로 Android 네트워크 통신 내역 디버깅하기
- api 호출을 로그캣으로 일일이 보는 게 번거롭고 불편하다면 여러 가지 방법으로 통신 내역을 확인할 수 있는 방법들이 있다.
- 오늘은 그 중 하나로 프록시맨 간단히 소개
Proxyman · Debug, intercept & mock HTTP with Proxyman
Narrow down your search with Proxyman's Multiple Filters. You can combine complex filtered criteria like Protocol, Content-Type, URL, Request Header, Response Header, Body, etc that find exact what you're looking for.
proxyman.com
- 사실 위 링크를 들어가면 방법이 다 자세히 나와있지만.. 일단 윈도나 맥에 맞는 파일을 설치해 준다.
- 그리고 자신의 PC와 디버깅 대상이 될 안드로이드 디바이스가 같은 Wifi 환경에 연결되어 있는지 확인한다.
- 이어서 프락시맨을 열고. 상단의 IP 주소 및 프록시 포트를 확인한다.
- 안드로이드의 설정 앱 > 연결 > Wi-Fi > 접속한 Wi-Fi의 오른쪽 톱니바퀴 설정 아이콘 클릭 > 더보기 또는 고급 > 프록시에 들어가서 다음과 같이 상단에서 확인한 IP 값과 Port 값을 설정해준다.
- 이어서 프록시맨 안드로이드 가이드를 내리다 보면 인증서를 다운로드하라는 부분이 있다.
https://docs.proxyman.com/debug-devices/android-device
Android Device & Emulator | Proxyman
How to set up Android Device or Emulator with Proxyman to capture HTTP/HTTPS Requests/Response
docs.proxyman.com
- 안드로이드 디바이스로 접속해서 해당 인증서를 다운로드하고, 아래 설명된 설정 경로를 따라 인증서를 설치 완료해 준다.
- 그리고, 디버깅 대상이 될 안드로이드 프로젝트를 열어서 xml - network_security_config.xml 파일에 아래와 같이 구성해 준다.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
<certificates src="system" />
</trust-anchors>
</debug-overrides>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config>
<!-- Make sure your URL Server here -->
<domain includeSubdomains="true">도메인명</domain>
<trust-anchors>
<certificates src="user"/>
<certificates src="system"/>
</trust-anchors>
</domain-config>
</network-security-config>
- AndroidManifest에 등록해 준다.
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
<application android:networkSecurityConfig="@xml/network_security_config" ... >
...
</application>
</manifest>
- 이제 프록시맨 재부팅하고 디바이스를 실행하면 네트워크 통신 내역 확인이 가능하다.