简体   繁体   English

Android-AdMob无法通过提供错误代码0来加载广告

[英]Android - AdMob is not loading Ads by giving Error code 0

I've used Firebase to impelment AdMob in some of my apps,In all apps it is working fine but in 1 of the apps it is giving following error: 我已经在某些应用中使用Firebase来促进AdMob的运行,在所有应用中它均能正常工作,但在其中1个应用中却出现以下错误:

There was a problem getting an ad response. 收到广告回应时出现问题。 ErrorCode: 0 Ads: Failed to load ad: 0 错误代码:0广告:无法加载广告:0

I have tried many solutions from google but not gain yet, Unit-Ids are OK as well. 我已经尝试了许多来自google的解决方案,但还没有获得,Unit-Id也可以。 Ads are loading in test devices but live Ads are causing the issue. 广告正在测试设备中加载,但实时广告引起了问题。 I have tried by changing the package name and creating new App at AdMob but still same issue. 我尝试过通过更改程序包名称并在AdMob上创建新的App来尝试,但仍然存在相同的问题。 Code piece is as following. 代码如下。 What is the issue? 有什么问题

MobileAds.initialize(this, "ca-app-pub-8845338895058113~6722149984");
            adInterstial = new AdInterstial(SplashActivity.this);
            mAdView = (AdView) findViewById(R.id.adView);
            final AdRequest adRequest = new AdRequest.Builder()
                    .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                     .addTestDevice(getString(R.string.admob_test_device))
                    .build();
            mAdView.loadAd(adRequest);

xml code xml代码

<com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id"
        android:visibility="visible"
        />

Its take some more time to come your ads in live.so wait for a few hours and try again. 投放广告需要花费更多时间。请耐心等待几个小时,然后重试。

From google Mobile Ads SDK Team answer it could be that you have only recently created a new Ad Unit ID and requesting for live ads. 从谷歌移动广告SDK团队那里回答,可能是您最近才创建了一个新的广告单元ID,并请求投放实时广告。 It could take a few hours for ads to start getting served if that is that case. 在这种情况下,广告可能需要花费几个小时才能开始投放。 If you are receiving test ads then your implementation is fine. 如果您要接收测试广告,则可以实施。 Just wait a few hours and see if you are able to receive live ads then. 只需等待几个小时,然后看看您是否能够接收实时广告。 If not, can send us your Ad Unit ID for us to look into. 如果没有,可以将您的广告单元ID发送给我们,以供我们参考。

Note : Google updated (Firebase and the Mobile Ads SDK) for mobile ads.Check you done all process from Google Mobile Ads SDK 注意: Google已针对移动广告更新了Firebase和Mobile Ads SDK。请检查您是否已通过Google Mobile Ads SDK完成了所有流程

compile 'com.google.firebase:firebase-ads:9.8.0

Error code 0 can be thrown because of many reasons, but mostly it will be (from my personal experience) because of the following two reasons: 可能由于许多原因而引发错误代码0,但主要是由于以下两个原因(根据我的个人经验):

  1. You have just created your ad unit so it's not initialised by google till now. 您刚刚创建了广告单元,因此Google到目前为止尚未对其进行初始化。 So wait for at least 3 to 4 hours. 因此,至少要等待3到4个小时。

  2. You have not initialised admob in your android app . 您尚未在Android应用程序中初始化admob。

     MobileAds.initialize(this, "YOUR_APP_ID"); 

so make sure to do that . 因此,请务必这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM