I have an Android app with 1mil+ downloads that uses admob. Everything works correctly, except Admob test ads (demo ad units) are not working anymore. Listing a device as test device still does the trick, and real ads work, but the sample ad unit id's seem to have stopped working. The weird thing is, I havent changed anything in my code, and the same problem occurs in previous project versions. Did admob change something over the last 5 months, explaining the
I/Ads: Ad failed to load : 3
errors I get? Thanks
They changed how test ads work with your package name. If you added apps-ads.txt, you can't use test ids any more with that package name. You should work with real ids and don't forget to add your current devices as a test device.
public static void initTestDevicesForAds() {
List<String> testDevices = new ArrayList<>();
testDevices.add(AdRequest.DEVICE_ID_EMULATOR);
testDevices.add("YOUR_DEVICE_ID");
//Add new test devices here.
RequestConfiguration requestConfiguration
= new RequestConfiguration.Builder()
.setTestDeviceIds(testDevices)
.build();
MobileAds.setRequestConfiguration(requestConfiguration);
}
if you still want to use test ids you can check Caution section real issue and solution described there. https://developers.google.com/admob/android/test-ads