About a year ago, Google introduced a new feature in the Play Console, the pre-launch report.

Each time you upload a new APK, Firebase Test Lab automatically launches and tests your app on various devices running different Android versions. After the tests are complete, you can access the results by going to Release management → Pre-launch report.

The pre-launch report is a very useful feature, since it goes through all of your screens, performs basic actions, and catches common issues and crashes, before you deploy your app to production.

Unfortunately, if your application happens to integrate with AdMob, then there’s a chance that Test Lab might get you into trouble. How? Well, it might be inadvertently clicking on your ad units while testing your app!

It is not clear whether AdMob automatically filters out traffic originating from the Firebase Test Lab, but two things are for sure:

Google considers any invalid clicks on your ad units as being your responsibility and may disable your account if they detect high levels of invalid activity:

"We understand that a third party may generate invalid activity on your ads without your knowledge or permission. However, ultimately it is your responsibility as the publisher to ensure that the activity on your ads is valid."

Test Lab’s own documentation explicitly mentions that you should notify your digital ad provider to filter out Test Lab requests:

"App developers should notify any digital advertising providers they work with to filter out revenues and all corresponding traffic generated from devices that belong to testing providers, including Test Lab."

So what can you do about it?

One approach could be to opt-out of the pre-launch report all together — just go to Settings → Pre-launch report and set to No. However, you will then lose the benefits of testing your app on all those devices before deployment.

Since Test Lab is unquestionably useful to many developers, the best approach would be to temporary disable your ad units, each time your application is running on that environment. The good news is that detecting if you are running on Test Lab is trivial to implement by using the code snippet below.

private boolean isTestDevice() { String testLabSetting = Settings.System.getString(getContentResolver(), "firebase.test.lab"); return "true".equals(testLabSetting); }

In any case, there’s no reason to be testing your ad units in the Test Lab, so make sure to disable them — even just to be on the safe side.