Emulator showing REAL ads instead of test ads

979 views
Skip to first unread message

XT

unread,
Sep 7, 2021, 6:04:56 PM9/7/21
to Google Mobile Ads SDK Developers

Hi,

According to the AdMob documentation, "Android emulators are automatically configured as test devices" ( https://developers.google.com/admob/android/test-ads ), and this has been true in the past. However, I now get real ads and not test ads on my emulated devices.

Since I'm not particularly interested in getting my account banned, I have unfortunately not been able to experiment much with changing my code or trying different emulator images. I know that the issue happened with a fresh Pixel 4, API 31 (revision 6, x86_64, Google Play) emulator, and I think it also happened with a Pixel 4, API 30 (revision 10, x86_64, Google Play) emulator.

The emulated device seems to have a device ID that is different from DEVICE_ID_EMULATOR, as per the message "I/Ads: Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("5404A14FD4F12A30DB07B0E6EAA50FA3")) to get test ads on this device." that was logged to logcat.

I would say this is a pretty serious issue – while testing my app I almost clicked on a real ad by accident because of this. I don't know if the bug is in the AdMob SDK, the emulator, or somewhere else, but I hope someone from Google can take a look at this.

XT

unread,
Sep 7, 2021, 6:06:51 PM9/7/21
to Google Mobile Ads SDK Developers
Forgot to mention this, I'm using the latest available version of play-services-ads (20.3.0).

Mobile Ads SDK Forum Advisor

unread,
Sep 8, 2021, 1:29:19 AM9/8/21
to xol...@gmail.com, google-adm...@googlegroups.com

Hello XT,

Thank you for reaching out to us.

For us to further investigate this, could you please provide the following details via Reply privately to author option or send it directly to mobileads...@gmail.com? Kindly inform us on this thread if you sent it directly to the email provided.

  • Sample app
  • Steps to replicate
  • Emulator device name and version

As a side note, if you're having trouble receiving private replies from us, please check your Spam folder. Additionally, please add the 'From address' on that email to your contact list to ensure we aren't flagged as Spam in future messages. If you don't see a message from us in your Spam folder, please email us directly at mobileads-...@google.com referring to this forum thread.

Regards,

Google Logo
Princess Pamela Pineda
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2NSE14:ref

ABQ App Source

unread,
Dec 8, 2022, 6:47:46 PM12/8/22
to Google Mobile Ads SDK Developers
Was there any resolution on this? I am seeing the same issue on Pixel emulators in Android Studio Dolphin (have to add the test device ID from the logcat to see test ads, using DEVICE_ID_EMULATOR shows real ads).

    val requestConfiguration = RequestConfiguration.Builder()
        .setTestDeviceIds(
            listOf(
                AdRequest.DEVICE_ID_EMULATOR // supposed to work, but doesn't
            )
        )
        .build()
       
    MobileAds.setRequestConfiguration(requestConfiguration)
    val request = AdRequest.Builder().build()

    // request.isTestDevice(context) returns false here on the emulator unless I add the device ID from the logcat to the list above

    ad?.loadAd(request)

-TV

Mobile Ads SDK Forum Advisor

unread,
Dec 9, 2022, 2:32:24 AM12/9/22
to abqapp...@gmail.com, google-adm...@googlegroups.com

Hello,

 

Michael here from Mobile Ads SDK support team. Thank you for reaching out to us.

 

Would you be able to confirm if you have followed this guide in adding your test device? Asking this as I am seeing a bit of differences with the implementation. If the issue persist while following the guide, kindly provide to us the below information so we can further check on our end:

  • Sample app
  • Steps to replicate
  • Emulator device name and version

 

You may send the requested details privately via "Reply to Author" button or with the below process.

 

If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

 

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002NSE14QAH&entry.80707362=00078228

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.

Regards,

Google Logo
Michael Angelo
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2NSE14:ref

Mobile Ads SDK Forum Advisor

unread,
Dec 12, 2022, 2:40:58 AM12/12/22
to abqapp...@gmail.com, google-adm...@googlegroups.com

Hello,

 

Thank you for your response.

 

I was asking if you have followed the guide as it appears that the same issue is not reproducible using our sample apps. Would you be able to confirm if you were able to replicate the issue in our sample apps as well?

 

Additionally, kindly provide the below information so we can further investigate on our end:

  • app id
  • ad unit id/s affected

 

You may send the requested details privately via "Reply To Author" button.

Regards,

Google Logo
Michael Angelo
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2NSE14:ref

ABQ App Source

unread,
Dec 12, 2022, 1:40:39 PM12/12/22
to Google Mobile Ads SDK Developers
Re-posting here (sorry for the duplicate) so it's part of this thread.

I cloned the sample app from the repository you linked (kotlin - AdaptiveBannerExample) and added a check to make sure it is a test device (since the example uses the test AD ID it will always see test ads - the issue here is what would happen when we use real AD IDs).

    private fun loadBanner() {
      adView.adUnitId = AD_UNIT_ID

      adView.setAdSize(adSize)

      // Create an ad request.
      val adRequest = AdRequest.Builder().build()

      // ADD THIS CHECK - check that this is a test device
      if( !adRequest.isTestDevice(this) ) {
        throw RuntimeException("TEST DEVICE REQUIRED")
      }


      // Start loading the ad in the background.
      adView.loadAd(adRequest)
    }

When I run this on the default Pixel 3a emulator (API 33 - Android Tiramisu Google APIs | x86_64) in a fresh install of Android Studio Dolphin it hits the added throw there in "loadBanner" ("TEST DEVICE REQUIRED") - the emulator is not set as a test device. Running without the throw and searching for "test device" in the logcat I see

    Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("6814D6B9B33BD9BE301C9D26D52D02C9")) to get test ads on this device.
   
If I add that device ID to the list during setup, it no longer throws and the logcat shows

    This request is sent from a test device.
   
For whatever reason, the emulator is not being automatically set as a test device, like the documentation says it should be.

-TV

MatJB

unread,
Dec 13, 2022, 7:07:22 AM12/13/22
to Google Mobile Ads SDK Developers

Hi,

We are seeing real ads on some emulators too, when we shouldn’t.

They do not have the TEST AD indication and we are seeing some impressions on the AdMob Reports too.

It seems to happen only in API 33. 

The same app when run on an emulator with API 31 shows the ads, but the TEST AD indicator is shown as expected.

Please, correct this as soon as possible, as we shouldn’t worry about showing ads (with the possibility of our accounts being disabled) when testing on emulators.

We are using Android Studio Dolphin (2021.3.1 Patch 1) and the Android Emulator version is 31.3.13.

Thanks,
Mat

ABQ App Source

unread,
Dec 13, 2022, 8:57:51 AM12/13/22
to Google Mobile Ads SDK Developers
I tested the AdaptiveBanner sample app on an API 31 emulator and see the same behavior as Mat.

API 31 - request.isTestDevice() returns TRUE and logcat shows "This request is sent from a test device."
API 33 - request.isTestDevice() returns FALSE and logcat shows "Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("...")) to get test ads on this device."

-TV

Mobile Ads SDK Forum Advisor

unread,
Dec 13, 2022, 11:09:41 AM12/13/22
to abqapp...@gmail.com, google-adm...@googlegroups.com
Hello all,

Thank you for sharing your additional context and findings on this thread. Allow me to share this to a wider team for further investigation and to get their insight as well. I'll update this thread the soonest I hear back from them.

Regards,
Google Logo
Teejay Wennie
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2NSE14:ref

Mobile Ads SDK Forum Advisor

unread,
Dec 15, 2022, 2:38:10 AM12/15/22
to google-adm...@googlegroups.com, abqapp...@gmail.com
Hello all,

Thanks for reaching out.

A few follow-ups to assist with the investigations:
  • As indicated in the developer documentation, Android emulators are automatically configured as test devices. I will take a look at the issue where in API 33 the `request.isTestDevice()` returns FALSE even if emulator is used. Does that happen every time?
  • Can you provide the Charles log that captures the ad requests (that have the URLs `https://googleads.g.doubleclick.net/mads/gma?...`)? If they are test requests, there will be the `adtest=on` query parameter.
  • The "real ad" screenshot that you provided doesn't look like a Google ad. Are you using mediation? If you do, I would suggest following the mediation partner's documentation to set up test ads/devices.

Regards,
Joshua

ref:_00D1U1174p._5004Q2NSE14:ref

Codeborne Apps

unread,
Dec 16, 2022, 12:51:15 PM12/16/22
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com, abqapp...@gmail.com

Hi Joshua,

Yes, real ads are shown every time in our app when we run it on an emulator with API 33.

I’ve added some logging to the code:

Log.d("AdsManager", "isTestDevice? ${ adRequest.isTestDevice(context) }")

And in API 31 the result is always true, while in API 33 it is always false.


Regarding the Charles log, I’ve used Mitmproxy to get the request results.

On API 31 the “adtest=on” is present, while in API 33 it is not.


In our case, we are not using mediation. 

Below is a screenshot of a banner ad in our app with API 31 and API 33.

As you can see in API 31 the Test Ad text is present, while in API 33 it isn't.

image.png
Kind regards,
Mat





--

---
You received this message because you are subscribed to a topic in the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/Kk0kDDYVbX0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/o5D_N000000000000000000000000000000000000000000000RMX96S00R_VAPu4cTO2oXGRFW2glSw%40sfdc.net.

Mobile Ads SDK Forum Advisor

unread,
Dec 16, 2022, 1:32:15 PM12/16/22
to codebor...@gmail.com, abqapp...@gmail.com, google-adm...@googlegroups.com
Hello Mat,

Thanks for the provided information, they are really helpful.

We are currently looking into it and will get back to you asap.

ABQ App Source

unread,
Mar 19, 2023, 8:05:00 PM3/19/23
to Google Mobile Ads SDK Developers
Is there any update on this? The issue is still happening (isTestDevice is still always false in API 33 emulators).

-TV

Mobile Ads SDK Forum Advisor

unread,
Mar 22, 2023, 10:32:33 AM3/22/23
to abqapp...@gmail.com, google-adm...@googlegroups.com
Hello there,

Thanks for reaching out.

We are still looking into the issue and will get back to you as soon as there is an update.

Mobile Ads SDK Forum Advisor

unread,
Mar 24, 2023, 4:40:06 AM3/24/23
to google-adm...@googlegroups.com, abqapp...@gmail.com
Hello there,

Our engineering team is still investigating the issue.

I will reply to this thread once there is an update.

Michal

unread,
Jul 15, 2023, 10:36:39 AM7/15/23
to Google Mobile Ads SDK Developers
Unfortunately, this issue is still not fixed.

It happened to me just right now. Using latest Admob Sdk - 22.2.0 and latest emulator image (x86_64 with Google APis) for API 33. Launched my game as saw real banner ad. Logcat showed:

Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("...")) to get test ads on this device.

What about emulators in Google Play's "Pre-launch reports"? Would they also show real ads for API 33?

Mobile Ads SDK Forum Advisor

unread,
Jul 17, 2023, 9:18:55 PM7/17/23
to g21.m...@gmail.com, google-adm...@googlegroups.com
Hello Michal,

Thanks for reaching out.

You mentioned that you saw a real banner ad although using an emulator, can you provide the below through private reply? Also, is it an AdMob or third-party ad (if you have mediation configured)?

ABQ App Source

unread,
Jul 17, 2023, 9:55:37 PM7/17/23
to Google Mobile Ads SDK Developers
Joshua,

We provided steps to replicate this in the sample app 8 months ago (and it is still happening in API 33 emulators). Have you or your engineering team at least been able to replicate this behavior on your end yet?

- TV

Michal

unread,
Jul 18, 2023, 5:39:26 AM7/18/23
to Google Mobile Ads SDK Developers
I don't have time right now to provide you capture request from charles. Maybe next week. But i doubt it will provide you more information than already sent by others here.

It was Admob only. No mediation. Anyway, all emulator images below API 33 were working fine (Admob always shows test ads on them), there is some problem with API 33 emulator image. I've tested exact same apk, just on different API images.

My main worry is Google Play automated testing before release. Because this testing simulates clicking too. That's serious risk for all develoeprs using Admob.

Mobile Ads SDK Forum Advisor

unread,
Jul 19, 2023, 1:42:16 PM7/19/23
to g21.m...@gmail.com, google-adm...@googlegroups.com
Hello Michal,

Thanks for the additional information.

I will once again prioritize this issue with the engineering team and give you all an update before end of next week.

Please feel free to reply to this thread if you are able to provide additional information or have any concerns.

Mobile Ads SDK Forum Advisor

unread,
Jul 19, 2023, 8:21:35 PM7/19/23
to g21.m...@gmail.com, google-adm...@googlegroups.com
Hello all,

Our engineering team has again confirmed that for an emulator with API level 33 or higher, the ad request won't be treated as a test request automatically. Therefore, please follow our documentation on enabling test ads to either add  your test device in the AdMob UI or programmatically. We are going to update the documentation to indicate that as well.
Reply all
Reply to author
Forward
0 new messages