Strict Secure Cookie policy error in AdMob after updating to Android 11

Viewed 7045

After updating my app to compile with API level 30 (Android R, 11), I can't see AdMob test ads, and I'm receiving this error in the log:

Strict Secure Cookie policy does not allow setting a secure cookie for http://googleads.g.doubleclick.net/ for apps targeting >= R. Please either use the 'https:' scheme for this URL or omit the 'Secure' directive in the cookie value.

I'm using the last AdMob version, and I don't have "org.apache.http.legacy" references in Gradle or manifest.

3 Answers

I'm using flutter and I'm facing the same issue while implementing banner test ads. Just add the below in android manifest file under application:

android:usesCleartextTraffic="true"

and issue will be resolved.

On Android, you can add a network security config XML. For Flutter to find your XML file, you need to also add a metadata entry to the <application> tag in your manifest. This metadata entry should carry the name: io.flutter.network-policy and should contain the resource identifier of the XML.

For instance, if you put your XML configuration under res/xml/network_security_config.xml, your manifest would contain the following:

<application ...>
  ...
  <meta-data android:name="io.flutter.network-policy"
             android:resource="@xml/network_security_config"/>
</application>

If you would like to allow HTTP connections for Android debug builds,

you can add the following snippet to your $project_path\android\app\src\debug\AndroidManifest.xml:

<application android:usesCleartextTraffic="true"/>

For more: https://docs.flutter.dev/release/breaking-changes/network-policy-ios-android

Related