Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google doubleclick ad requests are failing when Charles proxy is connected

We have been using Charles proxy for trouble shooting all the ad related stuff in our android app. We look at https://pubads.g.doubleclick.net/gampad/ads domain requests in charles and verify parameters passed to those requests.

from last few days(i think from last 1 month), all the ad related requests are failing when connected to charles with the message "You may need to configure your browser or application to trust the Charles Root Certificate. See SSL Proxying in the Help menu." My device and Charles are set up correctly as i am seeing traffic for other domains. You can observe this in the screenshot attached. Surprisingly this issue is not there in our iOS app.

Is there any changes happened lately in google DFP about using proxies? I did all basic stuff like installing charles certificate in mobile, changed proxy settings in the mobile etc.

This is the charles session screenshot.

like image 590
srikanth sanagapalli Avatar asked Jun 12 '18 16:06

srikanth sanagapalli


2 Answers

Along with NetworkSecurityConfig update mentioned in above answer you would also need to do following in the test device

  1. Go to "Device Settings".
  2. Click on "Google" (Service & Preference) option.
  3. Click on "Ads" option under Services.
  4. Enable the toggle for "Enable debug logging for ads".

Enable Ads Debug option

like image 102
Shyam Sunder Avatar answered Oct 12 '22 23:10

Shyam Sunder


Given that:

  1. Charles proxy settings are correct
  2. The root certificate is installed on your device

It is most likely that your app network security config does not trust user certificates. Since Android 7.0 the default settings is to only trust system certificates, thus user certificates are not trusted. Check this page: https://developer.android.com/training/articles/security-config

Here is an example how to override the network config to trust user certificates for debug builds of you app: Create an xml file: security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
    <trust-anchors>
        <certificates src="system" />
    </trust-anchors>
</base-config>
<debug-overrides>
    <trust-anchors>
        <certificates src="user" />
    </trust-anchors>
</debug-overrides>
</network-security-config>

Override your network config in the androidmanifest's application-tag

<application
android:networkSecurityConfig="@xml/security_config"
...
>
like image 37
user1354603 Avatar answered Oct 12 '22 23:10

user1354603