我的应用程序中包含的AbMob在模拟器上运行得很好但在我的设备上我总是得到相同的结果:
08-02 01:14:04.862: DEBUG/webviewglue(14152): nativeDestroy view: 0x7b77d0
08-02 01:14:04.862: INFO/Ads(14152): onFailedToReceiveAd(A network error occurred.)
08-02 01:14:05.002: INFO/Ads(14152): Received ad url: <"url": "http://r.admob.com:80/ad_source.php?preqs=617&u_sd=1&slotname=a14e2d89f8911de&u_h=480&u_w=320&msid=xxxxxxxxxxxxxxx.android&js=afma-sdk-a-v4.1.1&isu=061AC563478AB601B8B121B23C3BC875&format=320x50_mb&net=wi&app_name=1.android.xxxxxxxxxxxxxxxxxx.android&u_audio=3&hl=ru&u_so=p&output=html®ion=mobile_app&u_tz=-180&ex=1&client_sdk=1&askip=2", "afmaNotifyDt": "null">
08-02 01:14:05.042: WARN/Ads(14152): IOException connecting to ad url.
08-02 01:14:05.042: WARN/Ads(14152): java.net.ConnectException: r.admob.com/127.0.0.1:80 - Connection refused
08-02 01:14:05.042: WARN/Ads(14152): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:254)
08-02 01:14:05.042: WARN/Ads(14152): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:533)
08-02 01:14:05.042: WARN/Ads(14152): at java.net.Socket.connect(Socket.java:1055)
08-02 01:14:05.042: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
08-02 01:14:05.042: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
08-02 01:14:05.042: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
08-02 01:14:05.042: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
08-02 01:14:05.042: WARN/Ads(14152): at b.run(Unknown Source)
08-02 01:14:05.042: WARN/Ads(14152): at java.lang.Thread.run(Thread.java:1096)
08-02 01:14:05.042: DEBUG/webviewglue(14152): nativeDestroy view: 0x6a97a0
08-02 01:14:05.042: INFO/Ads(14152): onFailedToReceiveAd(A network error occurred.)
08-02 01:14:05.267: WARN/webcore(14152): Can't get the viewWidth after the first layout
08-02 01:14:05.547: INFO/Ads(14152): Received ad url: <"url": "http://r.admob.com:80/ad_source.php?preqs=618&u_sd=1&slotname=a14e2d89f8911de&u_h=480&u_w=320&msid=xxxxxxxxxxxxxxxxxxxxxxxxxx.android&js=afma-sdk-a-v4.1.1&isu=061AC563478AB601B8B121B23C3BC875&format=320x50_mb&net=wi&app_name=1.xxxxxxxxxxxxxxxxxxxxxxxxxx.android&u_audio=3&hl=ru&u_so=p&output=html®ion=mobile_app&u_tz=-180&ex=1&client_sdk=1&askip=3", "afmaNotifyDt": "null">
08-02 01:14:05.572: WARN/Ads(14152): IOException connecting to ad url.
08-02 01:14:05.572: WARN/Ads(14152): java.net.ConnectException: r.admob.com/127.0.0.1:80 - Connection refused
08-02 01:14:05.572: WARN/Ads(14152): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:254)
08-02 01:14:05.572: WARN/Ads(14152): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:533)
08-02 01:14:05.572: WARN/Ads(14152): at java.net.Socket.connect(Socket.java:1055)
08-02 01:14:05.572: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
08-02 01:14:05.572: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
08-02 01:14:05.572: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
08-02 01:14:05.572: WARN/Ads(14152): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
08-02 01:14:05.572: WARN/Ads(14152): at b.run(Unknown Source)
08-02 01:14:05.572: WARN/Ads(14152): at java.lang.Thread.run(Thread.java:1096)
08-02 01:14:05.572: DEBUG/webviewglue(14152): nativeDestroy view: 0x6e6508
并且此异常不断重复。它也说:
08-02 01:14:23.102: INFO/Ads(14152): onFailedToReceiveAd(A network error occurred.)
08-02 01:14:23.192: INFO/Ads(14152): To get test ads on this device, call adRequest.addTestDevice("061AC563478AB601B8B121B23C3BC875");
08-02 01:14:23.212: INFO/Ads(14152): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":629,"u_sd":1,"slotname":"xxxxxxxxxxxxxxxxx","u_h":480,"u_w":320,"msid":"xxxxxxxxxxxxxxxxxx.android","js":"afma-sdk-a-v4.1.1","isu":"061AC563478AB601B8B121B23C3BC875","format":"320x50_mb","net":"wi","app_name":"1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.android","u_audio":3,"hl":"ru"});</script></head><body></body></html>
08-02 01:14:23.402: INFO/Ads(14152): To get test ads on this device, call adRequest.addTestDevice("061AC563478AB601B8B121B23C3BC875");
08-02 01:14:23.422: INFO/Ads(14152): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":630,"u_sd":1,"slotname":"xxxxxxxxxxxxxxx","u_h":480,"u_w":320,"msid":"xxxxxxxxxx.android","js":"afma-sdk-a-v4.1.1","isu":"061AC563478AB601B8B121B23C3BC875","format":"320x50_mb","net":"wi","app_name":"1.android.xxxxxxxxxxxxxxxxxxxxxxxxxxxx.android","u_audio":3,"hl":"ru"});</script></head><body></body></html>
但是admob请求以通常的方式启动(意味着没有.setTesting(true))为什么我要adRequest.addTestDevice?
再次 - 它在模拟器上工作正常,但不适用于我的设备。我尝试了三星Galaxy Spica与froyo 2.2和HTC HD2与不同的Android版本(2.2,2.3等,至少5个不同的版本测试)。它只是用那些假的请求淹没了设备并且没有显示任何广告
那是为什么?
答案 0 :(得分:5)
您的/ etc / hosts文件已将r.admob.com重新定义为127.0.0.1 - 您从各种来源下载的自定义ROM都会这样做,因为ti会阻止所有广告。编辑/ etc / hosts文件并取出该条目。