我把admob放在一个应用程序中,我测试了它,它在模拟器和广告中工作正常,但当我尝试检查它是否在我的手机上工作广告不显示我在logcat中收到这些错误消息:
06-02 10:30:58.405: W/Ads(6148): IOException connecting to ad url.
06-02 10:30:58.405: W/Ads(6148): java.net.ConnectException: failed to connect to googleads.g.doubleclick.net/127.0.0.1 (port 80): connect failed: ECONNREFUSED (Connection refused)
06-02 10:30:58.405: W/Ads(6148): at libcore.io.IoBridge.connect(IoBridge.java:114)
06-02 10:30:58.405: W/Ads(6148): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
06-02 10:30:58.405: W/Ads(6148): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
06-02 10:30:58.405: W/Ads(6148): at java.net.Socket.connect(Socket.java:842)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
06-02 10:30:58.405: W/Ads(6148): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
06-02 10:30:58.405: W/Ads(6148): at com.google.ads.internal.f.b(SourceFile:428)
06-02 10:30:58.405: W/Ads(6148): at com.google.ads.internal.f.run(SourceFile:399)
06-02 10:30:58.405: W/Ads(6148): at java.lang.Thread.run(Thread.java:856)
06-02 10:30:58.405: W/Ads(6148): Caused by: libcore.io.ErrnoException: connect failed:
..................
手机已连接到wifi,互联网工作正常。
编辑: 它之所以不起作用的原因是因为我正在运行自定义ROM并且它阻止了所有广告,解决方法是编辑主机文件并从中删除所有广告拦截! :)
答案 0 :(得分:2)
这是您手机上的问题,而不是代码IMO,尝试启用飞行模式几秒钟然后禁用它。