AdMob的尝试连接在127.0.0.1和失败。始终闪光onFailedToReceiveAd(出现网络错误。)

问题描述:


包括在我的应用程序AbMob是工作得很好的仿真器,但我的设备上,我总是得到相同的:


AbMob included in my app is working just fine on emulator but on my device i always getting the same:

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&region=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&region=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

和这个异常不断重复。此外,它说:

and this exception constantly repeats. Also it says:

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(真))为什么我要adRequest.addTestDevice?
再一次 - 它工作正常,在模拟器,但不符合我的设备。我想三星Galaxy角宿一与升级Froyo 2.2和HTC HD2用不同的Andr​​oid版本(2.2,2.3等,至少有5种不同的测试版本)。它只是溺水设备与虚假请求,而不会显示广告
这是为什么呢?

but admob request started in usual way (meaning there is no .setTesting(true)) Why have I to adRequest.addTestDevice?
Once again - it works fine on emulator but not with my device. I tried Samsung Galaxy Spica with froyo 2.2 and HTC HD2 with different android versions (2.2, 2.3 etc, at least 5 different versions tested). It just drowning the device with those fake requests and displays no ads
Why is that?

您的/ etc / hosts文件已重新定义r.admob.com为127.0.0.1 - 你从各种来源下载所有做自定义光盘,因为TI阻挡所有广告。编辑/ etc / hosts文件,并采取了该条目。

Your /etc/hosts file has re-defined r.admob.com to 127.0.0.1 -- custom ROMs that you download from various sources all do that, because ti blocks out all the ads. Edit your /etc/hosts file and take out that entry.