简体   繁体   中英

AdMob test ads are not showing

I use the following code:

    AdRequest adRequest = new AdRequest();
    adRequest.setTesting(true);
    adRequest.addTestDevice(AdRequest.TEST_EMULATOR);   
    adRequest.addTestDevice("the right id"); 
    AdView adView = (AdView)convertView.findViewById(R.id.ad);
    adView.loadAd(adRequest);

With following layout:

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#fffff1c1"
        android:orientation="vertical"
        android:id="@+id/linlay" >

        <com.google.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="97f0f2e68d7e4b3c"
        />  
     </LinearLayout>

But the ads are not shown.

I get this logcat output:

14 17:14:37.990: I/Ads(11984): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":0,"session_id":"120070455177917556","seq_num":"1","slotname":"97f0f2e68d7e4b3c","u_w":360,"msid":"de.svennergr.polizeinews","adtest":"on","js":"afma-sdk-a-v6.2.1","bas_off":0,"net":"wi","app_name":"1.android.de.svennergr.polizeinews","hl":"de","smart_w":"full","gnt":2,"carrier":"26207","u_audio":3,"u_sd":2,"mv":"8015016.com.android.vending","isu":"F612B07AE7E85F9D4246F70B5C850CC3","cipa":0,"format":"360x50_mb","oar":0,"smart_h":"auto","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"u_h":592,"testing":1,"bas_on":0,"ptime":0});</script></head><body></body></html>
11-14 17:14:37.998: W/Ads(11984): loadAd called while the ad is already loading, so aborting.
11-14 17:14:38.373: I/Ads(11984): Received ad url: <url: "http://googleads.g.doubleclick.net:80/mads/mediate?preqs=0&session_id=120070455177917556&seq_num=1&slotname=97f0f2e68d7e4b3c&u_w=360&msid=de.svennergr.polizeinews&adtest=on&js=afma-sdk-a-v6.2.1&bas_off=0&net=wi&app_name=1.android.de.svennergr.polizeinews&hl=de&smart_w=full&gnt=2&carrier=26207&u_audio=3&u_sd=2&mv=8015016.com.android.vending&isu=F612B07AE7E85F9D4246F70B5C850CC3&cipa=0&format=360x50_mb&oar=0&smart_h=auto&u_h=592&bas_on=0&ptime=0&u_so=p&output=html&region=mobile_app&u_tz=-60&client_sdk=1&ex=1&gsb=wi&caps=inlineVideo_interactiveVideo_mraid1_th_mediation_sdkAdmobApiForAds_di&jsv=40" type: "gwhirl" afmaNotifyDt: "null" useWebViewLoadUrl: "false">
11-14 17:14:38.373: I/Ads(11984): Request scenario: Online server request.
11-14 17:14:38.568: I/Ads(11984): Caching gWhirl configuration for: 300 seconds
11-14 17:14:38.568: D/webviewglue(11984): nativeDestroy view: 0x5c4c1c58
11-14 17:14:38.568: W/Ads(11984): Mediation server returned ad size: '320x50_mb', while the AdView was created with ad size: '360x50_mb'. Using the ad-size passed to the AdView on creation.

我只是使用了错误的发布者ID。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM