Admob ads giving error code 2 (not displaying)

一世执手 提交于 2020-01-05 09:47:35

问题


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.


回答1:


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




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/32084134/admob-ads-giving-error-code-2-not-displaying

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!