gpt4 book ai didi

android - 获得广告响应。错误代码 : 1

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:49:25 28 4
gpt4 key购买 nike

我正在设备中测试我的应用程序,它在调试 logcat 中显示错误这是什么错误以及如何解决这个错误?

错误是

There was a problem getting an ad response. ErrorCode: 1

我的xml代码是

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/accent_material_light"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

>
<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>

我展示广告的代码是

AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

我正在添加 list 文件。代码工作正常但广告未显示我正在我的设备上测试它

<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />

最佳答案

尝试使用广告单元 ID。

您可能错误地使用了 APP ID 或 PUBLISHER ID..(就像我的错误一样)

广告单元 ID 示例(包含 xxxxx/xxxxx)

ca-app-pub-9390048287444061/3221111032 - 正确一个

示例 App ID(包含 xxxxx~xxxxx)

ca-app-pub-9390048287444061~1222077830 - 错了

关于android - 获得广告响应。错误代码 : 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33384445/

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