Cristian Ceron
Cristian Ceron

Reputation: 745

Admob ads giving error code 2 (not displaying)

I'm trying to make a basic libgdx app and the ads are not being displayed. I'm following these guides: https://developers.google.com/android/guides/setup

https://developers.google.com/admob/android/eclipse

https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx

The code is very basic, just the one copied from the libgdx guide. The code works but the ads are not being displayed.

Error code 2 libgdx

Upvotes: 1

Views: 7211

Answers (3)

Umar Hassan
Umar Hassan

Reputation: 312

In my case, Error Code 2 was due to a stupid mistake. I was using the same code to initialize AdMobs and my Ad unit. Both codes look similar and so are easy to be confused with each other.

Once solved, the code changed to 0, so, suspecting that my account wasn't ready yet, i used the test ID for interstitial ads and it worked like a charm.

Upvotes: 2

Someone Somewhere
Someone Somewhere

Reputation: 23787

you should try using the test device code, like this:

ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
AdRequest adRequest = new AdRequest.Builder().addTestDevice("id_shown_in_logcat_when_you_debug").build();
binding.adViewBanner.loadAd(adRequest);

if that works, then you need to take a look at your admob account and see if it shows an error. For example, with mine it said I needed to link the app in the play store.

if that doesn't work, then you've got another problem

Upvotes: 1

user2528167
user2528167

Reputation:

Disable your Ad blocker. Make sure you don't have an app like adBlock installed.

Anyway, that error means "Timed out waiting for ad response", so check your Internet connection and try changing from Wi-Fi to Mobile Network

Upvotes: 5

Related Questions