android - 无法加载广告(错误 1)

标签 android ads

已经在谷歌上搜索了几个小时,但仍然没有成功。 我总是收到错误消息并且广告横幅无法加载:

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

构建.gradle

compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'

Android list

<activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent"
        />

布局

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ads:adSize="BANNER"
    android:layout_marginTop="20dip"
    ads:adUnitId="pub-*****************"
    android:layout_below="@+id/middle"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

Activity (进口)

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

Activity

AdView adView = (AdView)findViewById(R.id.adView);

    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);

还添加了权限

提前谢谢你的帮助

最佳答案

错误1表示ID错误。

Admob 给你一个这样的数字,是通用 ID,带 ~ :

ca-app-pub-9611919736642270~3440171884

而带/的广告id就是请求;

ca-app-pub-9611919736642270/3440171834

关于android - 无法加载广告(错误 1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38835738/

相关文章:

android - Admob,填充率真的很差

iphone - 如何在 iOS 上使用 Facebook 的转化跟踪像素

javascript - Google AdSense 抛出错误 - 只有一个 'enable page level ads allowed per page'

java - 共享首选项中的 Android 颜色

javascript - 有没有办法将 JavaScript 注入(inject) WebView 以备后用?

android - 使用startApp测试设备

admob - 来自 Google AdMob 的过多广告调用

android - BLE startLeScan() : null

android - 关闭应用程序后出错

java - UDP Code客户端服务器架构