无法加载原生广告快递。 ErrorCode:0
的onCreate:
MobileAds.initialize(this, "my app id is here" );
NativeExpressAdView adView = (NativeExpressAdView)findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder().build();
adView.loadAd(request);
XML:
<RelativeLayout
android:layout_width="320dp"
android:background="@drawable/shadow"
android:layout_height="150dp"
android:id="@+id/addLayout"
android:layout_marginTop="8dp"
android:layout_below="@+id/firstSection"
android:layout_alignLeft="@+id/firstSection"
android:layout_alignStart="@+id/firstSection"
android:layout_alignRight="@+id/firstSection"
android:layout_alignEnd="@+id/firstSection">
<com.google.android.gms.ads.NativeExpressAdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-3940256099942544/2177258514" <!-- this is default id for testing -->
ads:adSize="320x150">
</com.google.android.gms.ads.NativeExpressAdView>
</RelativeLayout>
依赖关系:
dependencies {
compile 'com.google.firebase:firebase-ads:11.2.0'
}
日志:
I/Ads: Starting ad request.
I/Ads: Use AdRequest.Builder.addTestDevice("85A477B00D9A767978503D919F676E4C") to get test ads on this device.
W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0
为什么说我使用addTestDevice如果我的广告:xml中的adUnitId是用于测试的默认ID?
好吧,我添加addTestDevice广告请求,
用addTestDevice记录日志:
I/Ads: Starting ad request.
I/Ads: This request is sent from a test device.
W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0
在xml中是用于测试的默认id,它不能成为在google服务器中创建广告之前等待的问题。
我的设备有互联网,没有植根,没有广告拦截器,我的admob帐户可以与其他广告一起工作。 “我的应用程序ID在这里”是我的应用程序ID。
链接地址: http://www.djcxy.com/p/32395.html