Strict Secure Cookie policy does not allow setting a secure cookie for apps targeting >= R

· 129 words · 1 minute read

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 lastest AdMob version, and I don’t have “org.apache.http.legacy” references in Gradle or manifest.

The fix is to add the following line in the Android manifest.xml file inside <application .. >.

android:usesCleartextTraffic="true"

So, It is allowed – now – to get http and/or https.

I hope this helps you. You know someone will benefit from this, share it with him/her, a friend or colleage.

Share: