admob banner live ad not showing but test showing

瘦欲@ 提交于 2020-01-21 07:19:43

问题


MainActivity code:

MobileAds.initialize(this, getResources().getString(R.string.app_id));
mAdView = findViewById(R.id.adView);
            mAdView.setVisibility(View.VISIBLE);
            AdRequest adRequest = new AdRequest.Builder().build();
            mAdView.loadAd(adRequest); 

main_activity.xml file

 <com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="ca-app-pub-7758424290736454/1358492948" />

when i add Test ID ad is showing.:

ca-app-pub-3940256099942544/6300978111

i am getting below error logs

DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl
    01-29 16:19:28.141 6523-6523/com.recreation.cryptocurrencyrate I/art:     at void com.google.android.gms.ads.MobileAds.initialize(android.content.Context, java.lang.String, com.google.android.gms.ads.MobileAds$Settings) ((null):-1)
    01-29 16:19:28.141 6523-6523/com.recreation.cryptocurrencyrate I/art:     at void com.google.android.gms.ads.MobileAds.initialize(android.content.Context, java.lang.String) ((null):-1)
    01-29 16:19:28.142 6523-6523/com.recreation.cryptocurrencyrate I/art:     at void com.google.android.gms.ads.MobileAds.initialize(android.content.Context, java.lang.String, com.google.android.gms.ads.MobileAds$Settings) ((null):-1)
    01-29 16:19:28.142 6523-6523/com.recreation.cryptocurrencyrate I/art:     at void com.google.android.gms.ads.MobileAds.initialize(android.content.Context, java.lang.String) ((null):-1)
    01-29 16:19:30.961 6523-6523/com.recreation.cryptocurrencyrate I/Ads: Starting ad request.
    01-29 16:19:30.961 6523-6523/com.recreation.cryptocurrencyrate I/Ads: This request is sent from a test device.
    01-29 16:19:30.972 6523-6523/com.recreation.cryptocurrencyrate W/Ads: Not retrying to fetch app settings
    01-29 16:19:33.499 6523-6540/com.recreation.cryptocurrencyrate W/Ads: There was a problem getting an ad response. ErrorCode: 0
    01-29 16:19:33.506 6523-6523/com.recreation.cryptocurrencyrate W/Ads: Failed to load ad: 0

Admob App Unit id dashboard.


回答1:


Your Adunit Id is newly created so it will take time to review adunit and displaying ads in your app. Problem is with your created adunit Id. Its displaying test ads to me in my app with your AdUnit Id.

Follow below steps :-

To create a Live Ad unit id

Sign In to

https://apps.admob.com

in the left side menu click on ->Apps add app choose whether you have published your app on Google Play or the App Store if no -> Enter your app information Create Ad unit replace the test Ad unit with the new Ad unit. you get to see the AD once the app is published to playstore!




回答2:


May you check if you add codes below to your androidmanifest.xml;

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

And

 <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

in

It seems you added already

compile 'com.google.android.gms:play-services-ads:8.4.0'

to your build.gradle

If all done, ads should work.



来源:https://stackoverflow.com/questions/48501029/admob-banner-live-ad-not-showing-but-test-showing

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