onFailedToReceiveAd(无效广告请求) - 无法让AdMob显示横幅广告

时间:2014-01-08 19:57:15

标签: android admob

我已根据操作方法将AdMob横幅添加到我的应用程序中。但横幅永远不会显示,我已经使用与另一个应用程序相同的方式,一切都运行完美。找不到解决方案,检查了所有相关的Stack问题,什么都行不通:( 我使用了正确的发布商ID,并添加了GoogleAdMobAdsSdk-6.4.1.jar

我的xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background"
    android:orientation="vertical"
    tools:context=".MainActivity" >
    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_gravity="center_vertical"
        android:layout_weight="0.80" >
    </ListView>
 <com.google.ads.AdView android:id="@+id/adView"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   ads:adUnitId="pub_id"
   ads:adSize="BANNER"
      ads:loadAdOnCreate="true"/>     
</LinearLayout>

我的清单:

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.luckyyou.greatlaces"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
 <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="com.luckyyou.greatlaces.MainActivity"
            android:label="@string/app_name" 
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity 
 android:name="com.google.ads.AdActivity" 
 android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|  smallestScreenSize"/>

        <activity
            android:name="com.luckyyou.greatlaces.tab1"
            android:label="@string/name1" 
           android:theme="@android:style/Theme.Dialog"
            android:screenOrientation="portrait">  </activity> 

                 ...

             <activity
            android:name="com.luckyyou.greatlaces.tab12"
            android:label="@string/name12" 
            android:theme="@android:style/Theme.Dialog"
            android:screenOrientation="portrait">  
            </activity>

    </application>

 </manifest>

这是LogCat所说的:

01-08 14:21:52.778: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed 52K, 51% free 2674K/5379K, external 1527K/1559K, paused 242ms
01-08 14:21:55.431: ERROR/ActivityThread(1804): Failed to find provider info for com.google.plus.platform
01-08 14:21:55.518: INFO/Ads(1804): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
01-08 14:21:55.858: DEBUG/dalvikvm(1804): DexOpt: --- BEGIN 'ads-143252855.jar' (bootstrap=0) ---
01-08 14:21:56.198: DEBUG/dalvikvm(1818): DexOpt: load 64ms, verify+opt 75ms
01-08 14:21:56.378: DEBUG/dalvikvm(1804): DexOpt: --- END 'ads-143252855.jar' (success) ---
01-08 14:21:56.378: DEBUG/dalvikvm(1804): DEX prep '/data/data/com.luckyyou.greatlaces/cache/ads-143252855.jar': unzip in 34ms, rewrite 520ms
01-08 14:21:56.378: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed 217K, 50% free 2876K/5639K, external 2151K/2316K, paused 140ms
01-08 14:21:56.388: DEBUG/webviewglue(1804): nativeDestroy view: 0x91621b8
01-08 14:21:56.748: INFO/Ads(1804): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":0,"session_id":"9030672260837145206","seq_num":"1","slotname":"pub_id","u_w":320,"msid":"com.luckyyou.greatlaces","cap":"m,a","js":"afma-sdk-a-v6.4.1","bas_off":0,"net":"ed","app_name":"1.android.com.luckyyou.greatlaces","hl":"en","gnt":3,"carrier":"310260","u_audio":4,"kw":[],"u_sd":1.5,"simulator":1,"ms":"aESYziECsoJ_gzwNWoDn5OQjNPknVakDj2SrrKXxrOZsEWD6r4wsETa7CzeB3sCAwMmoFdWVd-PB3S-s381WQrdDEK_k05alE8tfJmkHWXNzJkS-Xql-6WqEEAgBc0-8cSp08YlmRv0xjgqH5yKehnOHMtOonYftI2DXsmFuMAwdjIOmWmCYaT7BjDQDlUzULzTvZRe6EvgSgalmiK-4Wfem4vJyo-QXzVRVG5Ng0WRcCebjE0LIulSyCsQyngqLWg2VhqUfHzGfiru4NxSUYV3GvxksLLXeShEv8X00-c629-Loha16sjyWYc0ecQ9gerTls_FvObQwTYyTb3jqRg","isu":"B3EEABB8EE11C2BE770B684D95219ECB","format":"320x50_mb","oar":0,"ad_pos":{"height":0,"visible":0,"y":76,"x":0,"width":0},"u_h":533,"pt":1,"bas_on":0,"ptime":0});</script></head><body></body></html>
01-08 14:21:56.918: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed 128K, 49% free 2886K/5639K, external 2438K/3005K, paused 108ms
01-08 14:21:57.550: DEBUG/dalvikvm(1804): GC_EXTERNAL_ALLOC freed <1K, 49% free 2885K/5639K, external 4395K/5489K, paused 126ms
01-08 14:21:58.507: DEBUG/gralloc_goldfish(1804): Emulator without GPU emulation detected.
01-08 14:21:59.218: INFO/ActivityManager(858): Displayed com.luckyyou.greatlaces/.MainActivity: +7s494ms
01-08 14:22:00.818: WARN/webcore(1804): Can't get the viewWidth after the first layout
01-08 14:22:00.998: WARN/Ads(1804): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?
 01-08 14:22:00.998: DEBUG/webviewglue(1804): nativeDestroy view: 0x915dbd0
 01-08 14:22:01.008: INFO/Ads(1804): onFailedToReceiveAd(Invalid Ad request.)
 01-08 14:22:05.238: DEBUG/dalvikvm(1131): GC_EXPLICIT freed 9K, 52% free 2662K/5511K,         external 1527K/1559K, paused 149ms

1 个答案:

答案 0 :(得分:0)

这些看起来是日志中的相关行。

由于您的布局看起来不错,我怀疑您在应用程序的主题中做了一些时髦的事情,导致与视图宽度混淆。查看你的@ style / AppTheme配置。

01-08 14:22:00.818: WARN/webcore(1804): Can't get the viewWidth after the first layout 
01-08 14:22:00.998: WARN/Ads(1804): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?

最后一件事:你说你使用的是Admob-6.4.1。您是否也在使用GooglePlayServices库?如果是这样,您可能无意中使用了GPS中的某些Admob类。如果是这种情况,那么我建议删除Admob-6.4.1并使用GPS进行100%。