admob横幅实时广告未展示但正在测试展示 [英] admob banner live ad not showing but test showing
问题描述
MainActivity代码:
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文件
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" />
当我添加测试ID广告时显示:
when i add Test ID ad is showing.:
ca-app-pub-3940256099942544 / 6300978111
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应用单元ID仪表板。
Admob App Unit id dashboard.
推荐答案
您的广告单元ID是新创建的,因此需要花费一些时间来审核广告单元并在您的应用中展示广告。问题在于您创建的广告单元ID。
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 :-
到创建一个实时广告单元ID
To create a Live Ad unit id
登录
在左侧菜单中,点击-> Apps
添加应用程序
选择是否在Google Play或App Store上发布了应用程序
(如果没有)->输入应用程序信息
创建广告单元
替换测试广告单元与新的广告单元。将应用发布到Playstore后,您会看到
广告!
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!
这篇关于admob横幅实时广告未展示但正在测试展示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!