Devices and runtimes
Android
Capture an Android emulator or USB device with one click through adb, install the Cloak Proxy certificate, and let your app trust user certificates.
Cloak Proxy can set up an Android emulator or a USB-connected Android device for you through adb, the Android Debug Bridge. It forwards the device’s proxy port to your Mac, sets the device’s proxy, and copies the certificate to it. Because Android apps ignore user-installed certificates by default, your app also needs a small network security config in its debug build.
The Android page when adb is installed.
- Forwards the port and sets the device's proxy
- Removes the proxy and the port forward
- Copies the certificate to the device's Downloads folder
- Lists the devices adb can see
Install adb
Section titled “Install adb”The one-click buttons need adb. Cloak Proxy looks for it in these places, in order:
| Location | Installed by |
|---|---|
/opt/homebrew/bin/adb |
Homebrew on Apple silicon |
/usr/local/bin/adb |
Homebrew on Intel, or a manual install |
/usr/bin/adb |
A manual install |
~/Library/Android/sdk/platform-tools/adb |
Android Studio’s SDK Manager |
If it finds none, the Android page shows adb wasn’t found. Install Android platform tools (brew install android-platform-tools) for one-click setup. in place of the buttons.
brew install android-platform-toolsAfter installing, switch to another tab and back, or reopen the window, so Cloak Proxy finds adb.
Connect an emulator or USB device
Section titled “Connect an emulator or USB device”The Emulator or USB-connected device (adb) section uses adb reverse, so the device reaches Cloak Proxy over USB or the emulator bridge. You don’t need to change Wi-Fi settings on the device or let other devices connect to the Mac.
-
Start the emulator, or connect the device with a USB cable and turn on USB debugging in its Developer options. Accept the prompt on the device to allow your Mac.
-
Open Device & Runtime Setup (click Devices in the toolbar) and choose Android in its sidebar.
-
Click Show Connected Devices to confirm
adbsees exactly one device. -
Click Connect Proxy.
The output area shows Proxy set to 127.0.0.1:9090 on the device. If either command fails, it shows
adb’s error instead. -
Click Push Certificate, then install it on the device. See Install the certificate.
What each button does
Section titled “What each button does”The buttons use the port Cloak Proxy is listening on (9090 by default).
| Button | Commands it runs | Result message |
|---|---|---|
| Connect Proxy | adb reverse tcp:9090 tcp:9090, then adb shell settings put global http_proxy 127.0.0.1:9090 |
Proxy set to 127.0.0.1:9090 on the device. |
| Disconnect Proxy | adb shell settings put global http_proxy :0, then adb reverse --remove tcp:9090 |
Proxy removed from the device. |
| Push Certificate | adb push <certificate> /sdcard/Download/cloak-proxy-ca.crt |
Copied to Downloads. On the device: Settings → Security → Encryption & credentials → Install a certificate → CA certificate. |
| Show Connected Devices | adb devices -l |
The list of devices, with their model names. |
adb reverse makes port 9090 on the device lead to port 9090 on your Mac, so the device’s proxy can be 127.0.0.1:9090. The global http_proxy setting is Android’s device-wide proxy, which apps that use the system proxy follow for both HTTP and HTTPS.
If the device loses its connection
Section titled “If the device loses its connection”The device’s proxy, 127.0.0.1:9090, only reaches your Mac through the adb reverse forward. Unplugging the cable, restarting the emulator or restarting the adb server ends the forward, but the proxy setting stays, so the device has no internet at all.
While adb is running, the Doctor checks each device whose proxy is on its own loopback with adb reverse --list. When the forward for the proxy’s port is gone, it reports a problem, adb reverse is gone: the device has no internet, on the Doctor and at the top of the Android page, with Re-run adb reverse. That runs adb -s <device> reverse tcp:9090 tcp:9090 and leaves the device’s proxy setting alone.
An emulator still pointed at 127.0.0.1:9090 after adb lost its forward.
The Doctor never starts adb: it only checks while the adb server is already running, so a device that was unplugged with adb stopped shows up once you start adb again (for example by plugging it back in and clicking Show Connected Devices). If you’re done capturing, click Disconnect Proxy instead to clear the device’s proxy.
With an assistant, capture_setup with target android lists the same step (android-reverse), and applying it re-runs adb reverse.
Install the certificate
Section titled “Install the certificate”Push Certificate copies the Cloak Proxy root certificate to the device’s Download folder as cloak-proxy-ca.crt. Android then needs you to install it.
-
On the device, open Settings › Security › Encryption & credentials. On some devices it’s under Settings › Security & privacy › More security settings or a similar path; search Settings for “certificate” if you can’t find it.
-
Tap Install a certificate, then CA certificate.
-
Android warns that a CA lets others see your data. Tap Install anyway.
-
Choose
cloak-proxy-ca.crtfrom the Download folder and confirm with the screen lock if asked.
The certificate is now a user certificate. Android’s browser and apps that opt in trust it. Most apps don’t trust it yet: see the next section.
You can also get the certificate without adb: once the device’s proxy points at Cloak Proxy, open http://cloak.proxy in the device’s browser and tap Download certificate (DER, Android / Windows). See Other devices and access control.
Let your debug build trust Cloak Proxy
Section titled “Let your debug build trust Cloak Proxy”Apps targeting Android 7 (API level 24) or later ignore user-installed certificates unless their network security config allows it. Cloak Proxy writes that config into your app’s src/debug source set, so release builds don’t change.
The files Cloak Proxy wrote into a project's src/debug.
-
On the Android page of Device & Runtime Setup, choose how the app trusts Cloak Proxy:
Choice What it writes On the device Bundle the Cloak Proxy certificate (default) The config with <certificates src="@raw/cloak_proxy_ca" />and the certificate asres/raw/cloak_proxy_ca.pemNothing to install Trust user-installed certificates The config with <certificates src="user" />Install the certificate (Push Certificate, above) -
Optionally type domains in Only for domains (
api.example.com, example.org) to trust Cloak Proxy for those domains and their subdomains only. Empty means every domain. -
Click Add to Project… and pick your Android project, its app module, or a Flutter project (Cloak Proxy finds
app/orandroid/app/). The section lists each file it will create or update. -
Click Write N Files, then build and install a debug build.
| File | When |
|---|---|
src/debug/res/xml/network_security_config.xml |
Always. If src/main already has a config (the manifest’s android:networkSecurityConfig), Cloak Proxy copies it into src/debug under the same name and adds its trust to it, so your other settings stay. |
src/debug/res/raw/cloak_proxy_ca.pem |
With Bundle the Cloak Proxy certificate |
src/debug/AndroidManifest.xml |
When no manifest names a config yet. Gradle merges it into debug builds only. An existing debug manifest gets the attribute added. |
Writing again changes nothing once the files are in place. To undo, delete the files Cloak Proxy created in src/debug.
You can’t add this to apps you don’t build, so most third-party apps on Android 7 and later can’t be decrypted.
AI assistants use capture_config with kind: "android_network_config" (or capture_setup with apply: "network-security-config"); in Terminal, cloakctl capture-config android --project . --write.
Then add your API’s host to SSL Proxying so Cloak Proxy decrypts it.
Use Wi-Fi instead of adb
Section titled “Use Wi-Fi instead of adb”For a device you can’t connect over USB, use the Wi-Fi proxy, the same way as an iPhone.
-
In Cloak Proxy, turn on Allow other devices to connect (phones, other computers) in Settings › General and click Apply & Restart Proxy. The setting shows This Mac’s address, for example
192.168.1.20:9090. -
On the device, open the Wi-Fi network’s settings, find Proxy (often under Advanced options), and choose Manual.
-
Enter your Mac’s address as the proxy hostname and
9090as the port, then save. -
Open
http://cloak.proxyin the device’s browser, tap Download certificate (DER, Android / Windows), and install it as a CA certificate.
The exact Wi-Fi settings path differs between Android versions and manufacturers. Traffic from a Wi-Fi device appears in the sidebar under its IP address.
Undo the setup
Section titled “Undo the setup”-
Click Disconnect Proxy. It clears the device’s proxy and removes the port forward. Do this before you unplug the device or quit Cloak Proxy: a device whose proxy is
127.0.0.1:9090without the forward can’t reach the internet.Without Cloak Proxy, run the same commands yourself:
Terminal adb shell settings put global http_proxy :0adb reverse --remove tcp:9090If the device has no internet after you unplug it, its proxy is still set: plug it back in and click Disconnect Proxy, or on the device clear Settings › Network › Proxy.
-
Remove the certificate on the device: open Settings › Security › Encryption & credentials › User credentials (or Trusted credentials › User), select the Cloak Proxy CA, and remove it. Delete
cloak-proxy-ca.crtfrom Download too. -
If you used Wi-Fi, set the network’s proxy back to None, and turn off Allow other devices to connect on the Mac.
If you regenerate the root certificate in Settings › Certificate, push and install the new one.