Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrei-fedorov/f7c820628f2b1ff7d9d3a66a2545a9f8 to your computer and use it in GitHub Desktop.
Save andrei-fedorov/f7c820628f2b1ff7d9d3a66a2545a9f8 to your computer and use it in GitHub Desktop.

Revisions

  1. @twaddington twaddington revised this gist Apr 29, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # Charles Proxy Android

    > Note: Consider using [mitmproxy](https://mitmproxy.org/) instead of Charles. There is better, more recent, documentation for [using mitmproxy on Android](https://docs.mitmproxy.org/stable/howto-install-system-trusted-ca-android/).
    ## Steps

    ### 1. Add the Network Security Configuration to your app
  2. @twaddington twaddington revised this gist Apr 7, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -60,7 +60,8 @@ You should now see hostnames correctly in Charles. If not, try restarting the pr

    ## Notes

    You may also have to enable the "Proxy -> macOS Proxy" setting in Charles.
    - You may also have to enable the "Proxy -> macOS Proxy" setting in Charles.
    - You may have to disable WiFi in the emulator to see hostnames in Charles.

    ## References

  3. @twaddington twaddington revised this gist Mar 24, 2020. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -58,6 +58,10 @@ Charles should now be proxying requests but instead of hostnames you're going to

    You should now see hostnames correctly in Charles. If not, try restarting the proxy a few times.

    ## Notes

    You may also have to enable the "Proxy -> macOS Proxy" setting in Charles.

    ## References

    - https://developers.google.com/admob/android/charles
  4. @twaddington twaddington revised this gist Mar 24, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -36,6 +36,8 @@
    - Update the "Hostname" to "127.0.0.1" and "Port number" to "8888"
    - Click "Apply"

    Your settings should now look [like this](https://user-images.githubusercontent.com/107117/77475404-ae3d3380-6e10-11ea-8ff9-9541b6883e63.png).

    ### 4. Install the Charles certificate

    - Launch Charles and enable SSL proxying.
  5. @twaddington twaddington revised this gist Mar 24, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Charlex Proxy Android
    # Charles Proxy Android

    ## Steps

  6. @twaddington twaddington revised this gist Mar 24, 2020. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,21 @@
    - You should be prompted to download a cert file.
    - Save the file with any name.

    ### 5. Create custom APN

    Charles should now be proxying requests but instead of hostnames you're going to see IP addresses. This makes it difficult to filter on specific hosts. To fix this you'll need to:

    - In Android, navigate to "Settings -> Network & Internet -> Mobile network -> (Advanced) Access point names"
    - Tap the "Plus" icon in the toolbar to add a new APN.
    - Use any name, set APN to "http://", proxy to "10.0.2.2", and port to "8888"
    - Tap the overflow menu in the upper right and then "Save"
    - Make sure to mark your new APN as active
    - Now you may need to toggle airplane mode on and off a few times to get it to take.

    You should now see hostnames correctly in Charles. If not, try restarting the proxy a few times.

    ## References

    - https://developers.google.com/admob/android/charles
    - https://medium.com/@daptronic/the-android-emulator-and-charles-proxy-a-love-story-595c23484e02
    - https://medium.com/@daptronic/the-android-emulator-and-charles-proxy-a-love-story-595c23484e02
    - https://stackoverflow.com/questions/33724755/charles-proxy-ssl-connections-wont-show-hostnames-only-ips/46054993#46054993
  7. @twaddington twaddington revised this gist Mar 24, 2020. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -36,8 +36,14 @@
    - Update the "Hostname" to "127.0.0.1" and "Port number" to "8888"
    - Click "Apply"

    ### 4. Install the Charles certificate

    - Launch Charles and enable SSL proxying.
    - In your emulator, open a web browser and navigate to https://chls.pro/ssl
    - You should be prompted to download a cert file.
    - Save the file with any name.

    ## References

    - https://developers.google.com/admob/android/charles
    - https://medium.com/@daptronic/the-android-emulator-and-charles-proxy-a-love-story-595c23484e02
    -
    - https://medium.com/@daptronic/the-android-emulator-and-charles-proxy-a-love-story-595c23484e02
  8. @twaddington twaddington created this gist Mar 24, 2020.
    43 changes: 43 additions & 0 deletions charles-proxy-android.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    # Charlex Proxy Android

    ## Steps

    ### 1. Add the Network Security Configuration to your app

    ```xml
    <network-security-config>
    <debug-overrides>
    <trust-anchors>
    <!-- Trust user added CAs while debuggable only -->
    <certificates src="user" />
    </trust-anchors>
    </debug-overrides>
    </network-security-config>
    ```

    ### 2. Update the Android Manifest

    ```xml
    <?xml version="1.0" encoding="utf-8"?>
    <manifest ... >
    <application ...
    android:networkSecurityConfig="@xml/network_security_config"
    ... >
    ...
    </application>
    </manifest>
    ```

    ### 3. Update the Emulator proxy

    - Launch the emulator and open "Settings -> Proxy"
    - Uncheck "Use Android Studio HTTP proxy settings"
    - Check "Manual proxy configuration"
    - Update the "Hostname" to "127.0.0.1" and "Port number" to "8888"
    - Click "Apply"

    ## References

    - https://developers.google.com/admob/android/charles
    - https://medium.com/@daptronic/the-android-emulator-and-charles-proxy-a-love-story-595c23484e02
    -