# Charlex Proxy Android ## Steps ### 1. Add the Network Security Configuration to your app ```xml ``` ### 2. Update the Android Manifest ```xml ... ``` ### 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" ### 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. ### 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://stackoverflow.com/questions/33724755/charles-proxy-ssl-connections-wont-show-hostnames-only-ips/46054993#46054993