简体   繁体   English

广告未显示,错误403

[英]Ads not displaying, error 403

Admob is not displaying ads for my app.Test ads are displaying but real ads are not. Admob没有为我的应用展示广告。测试广告正在展示,但真正的广告却没有。

This error should be shown if my account is disabled. 如果我的帐户被禁用,则应显示此错误。 But I'm able to log into my admob account. 但我可以登录我的admob帐户。

I also tested it on other phones with different accounts also with different connectivity but still no use. 我也在不同帐户的其他手机上进行了测试,但也有不同的连接但仍无用。

here is the log 这是日志

W/Ads: Received error HTTP response code: 403
 /myapp.test W/Ads: There was a problem getting an ad response. ErrorCode: 0
 /myapp.test W/Ads: Failed to load ad: 0

---Later added--- ---后来补充---

Here is the layout file 这是布局文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="15dp"
    android:orientation="vertical"
    app:behavior_overlapTop="64dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    app:theme="@style/AppTheme"
    tools:showIn="@layout/activity_main">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <android.support.v7.widget.CardView
                android:id="@+id/baseView"
                android:layout_width="match_parent"
                android:layout_height="280dp"
                android:padding="10dp">

            </android.support.v7.widget.CardView>
            <RelativeLayout
                android:layout_marginTop="30dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
            <com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
                android:id="@+id/adView"
                android:layout_centerHorizontal="true"
                android:layout_width="320dp"
                android:layout_height="50dp"
                ads:adSize="BANNER"
                ads:adUnitId="@string/admain" />
            </RelativeLayout>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

</LinearLayout>

This is how I called ads in the main activity 这就是我在主要活动中调用广告的方式

MobileAds.initialize(getApplicationContext(), getString(R.string.appid));
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().addTestDevice(getResources().getString(R.string.test)).build();
mAdView.loadAd(adRequest);

This is gradle 这是一种谜语

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

}
apply plugin: 'com.google.gms.google-services'

---Later added--- ---后来补充---

Once ads were displaying. 广告展示后。 Later my account get blocked.After a month its now active. 后来我的帐户被封锁。一个月后它现在活跃了。 The apps I made prior to the blocking isn't showing ads. 我在阻止之前制作的应用不会展示广告。 But new apps are showing ads without any issue.. 但新应用正在展示没有任何问题的广告。

I think the only possible solution is to change the package-name to a different one. 我认为唯一可行的解​​决方案是将package-name更改为另一个。 It worked for me! 它对我有用!

This happened to my project in progress too. 这也发生在我正在进行的项目中。 In my case, it was caused by the lack of personal information for AdMob. 就我而言,这是由于AdMob缺乏个人信息造成的。 After I entered the info below on AdMob console, the ads started to be displayed normally. 在AdMob控制台上输入以下信息后,广告开始正常显示。

Settings -> Contact Name 设置 - >联系人姓名

Payments -> Manage settings -> Business name and address 付款 - >管理设置 - >商家名称和地址

I hope if this helps someone who faces this issue. 我希望这能帮助那些面临这个问题的人。

I found a working solution for the problem I stated above. 我找到了解决上述问题的可行解决方案。 I built the app with different packagename and different ad-units were placed and the issue was solved!! 我用不同的包名构建了应用程序,并放置了不同的广告单元,问题解决了!!

Not a perfect solution but, hope this help! 不是一个完美的解决方案,但希望这有帮助!

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

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