0

I put admob in a app, and I tested it and it works fine in a emulator and the ads show, but when I try to check if it works on my phone the ads dont show and I get these error messages in 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:
.................. 

The phone is connected to wifi and the internet is working fine.

EDIT: The reason why it it didn't work is because I'm running a custom rom and it blocked all ads, the workaround was to edit the hosts file and remove all the adblocking from it! :)

William L.
  • 3,846
  • 9
  • 53
  • 72

1 Answers1

2

It's a problem on your phones side, rather than your code IMO, try enabling airplane mode for a few seconds and then disabling it.

Broak
  • 4,161
  • 4
  • 31
  • 54