gpt4 book ai didi

android - Admob 给我 ErrorCode : 1

转载 作者:行者123 更新时间:2023-11-29 15:39:40 24 4
gpt4 key购买 nike

W/Ads: There was a problem getting an ad response. ErrorCode: 1
W/Ads: Failed to load ad: 1

来自 logcat,

这是我在 Activity 中的代码:

MobileAds.initialize(getApplicationContext(), "ca-app-pub-6122511777440087~4654564876");
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();

mAdView.loadAd(adRequest);

和布局:

<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">
</com.google.android.gms.ads.AdView>

最后是我的字符串资源:

<string name="banner_ad_unit_id">ca-app-pub-6122511777440087~4654564876</string>

什么给了?我什至尝试了一个测试广告,但没有用。相同的错误代码和相同的广告加载失败。

最佳答案

app id 和 app unit id 应该不同。在你的代码中似乎是一样的

这是完整的官方描述:https://firebase.google.com/docs/admob/android/quick-start

关于android - Admob 给我 ErrorCode : 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42882191/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com