I am modifying an android app, which used to work, but the test ad is no longer loaded and in the Android Studio log I see:
Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("8B…D76C") to get test ads on this device.
I tried to add that to the code, but I get a “Cannot resolve symbol ‘RequestConfiguration’. Unfortunately Android Studio is not suggesting what's the package which needs to be imported.
This is how the code look after adding the requested line.
RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("device_id_3");
AdRequest adRequest = new AdRequest.Builder()
// Add a test device to show Test Ads
.addTestDevice(“device_id_1")
.addTestDevice("device_id_2")
.addTestDevice("device_id_3")
.build();
// Load ads into Banner Ads
adView.loadAd(adRequest);
Firebase is not needed, if you check AdMob documentation: https://developers.google.com/admob/android/test-ads#enable_test_devices , you will need to add following code instead of what the suggestion you see in the log cat:
List<String> testDeviceIds = Arrays.asList("<<< copy the device ID from logcat here >>>");
RequestConfiguration configuration =
new RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build();
MobileAds.setRequestConfiguration(configuration);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With