You've already forked element-x-android
mirror of
https://github.com/element-hq/element-x-android.git
synced 2026-10-23 18:49:00 +03:00
The doc told the reader to add disableSslVerification() to RustMatrixClientFactory.create(), which has not built the client for a long time; getBaseClientBuilder() is where the chain lives, and it covers both the login client and the restored session client. It also only described the emulator's own proxy setting, while the app already follows the device's global proxy through DefaultProxyProvider, which is the only way to do this on a physical device.
2.3 KiB
2.3 KiB
Setup a debug mitm proxy to inspect all the app's network traffic
- Install mitmproxy:
brew install mitmproxy.- Launch
mitmwebfrom a terminal. It will pop up mitmproxy's web interface in a web browser.
- Launch
- Configure Android Emulator.
- Launch your android emulator.
- Open its settings page and go to Settings -> Proxy (nb this tab isn't visible when running the emu inside the Android Studio window, you need to set it so it runs in its own window).
- Disable "Use Android Studio HTTP proxy settings" and pick "Manual proxy configuration".
- Set
127.0.0.1as "Host name" and8080as "Port number". - Click "Apply" and verify that "Proxy status" is "Success" and close the settings window.
- Alternatively, set the proxy on the device itself, which the app honours through
DefaultProxyProvider, and which also works on a physical device:Useadb shell settings put global http_proxy 10.0.2.2:8080adb shell settings delete global http_proxyto remove it afterwards. On a physical device, replace10.0.2.2with the address of the machine running mitmproxy.
- Install the mitmproxy CA cert (this is needed to see traffic from java/kotlin code, it's not needed for traffic coming from native code e.g. the matrix-rust-sdk).
- Slightly modify the Element X app source code.
- Go to the
RustMatrixClientFactory.getBaseClientBuilder()method, which builds every client the app creates, whether it is logging in or restoring a session. - Add
.disableSslVerification()in theClientBuildermethod chain.
- Go to the
- Build and run the Element X app.
- Enjoy, you will see all the traffic in mitmproxy's web interface.