问题描述:

I am trying to have my ads (Admob) refresh every minute but every time it tries to refresh I get this:

02-19 11:31:01.209: INFO/Ads(23514): Received ad url: <"url": "http://googleads.g.doubleclick.net:80/mads/gma?preqs=1&u_sd=1&slotname=a14dffcf49bd166&u_w=768&msid=m.s&cap=m&js=afma-sdk-a-v4.3.1&mv=8010004.com.android.vending&isu=16252B9186250264A14DCFAC778270C6&cipa=0&format=320x50_mb&net=wi&app_name=1.android.m.s&hl=en&u_h=1024&u_audio=1&prl=4712&u_so=p&output=html&region=mobile_app&u_tz=300&ex=1&client_sdk=1&askip=1&pto=0&caps=GmsgVideoPlayer_SdkAdmobApiForAds&jsv=3", "afmaNotifyDt": "null">

02-19 11:31:01.219: WARN/Ads(23514): IOException connecting to ad url.

02-19 11:31:01.219: WARN/Ads(23514): java.io.IOException: Bad file number

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.platform.OSFileSystem.ioctlAvailable(Native Method)

02-19 11:31:01.219: WARN/Ads(23514): at dalvik.system.BlockGuard$WrappedFileSystem.ioctlAvailable(BlockGuard.java:241)

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.net.PlainSocketImpl.available(PlainSocketImpl.java:152)

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.net.SocketInputStream.available(SocketInputStream.java:48)

02-19 11:31:01.219: WARN/Ads(23514): at java.io.BufferedInputStream.available(BufferedInputStream.java:112)

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.isStale(HttpConnection.java:222)

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:77)

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)

02-19 11:31:01.219: WARN/Ads(23514): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205)

02-19 11:31:01.219: WARN/Ads(23514): at com.google.ads.b.run(SourceFile:280)

02-19 11:31:01.219: WARN/Ads(23514): at java.lang.Thread.run(Thread.java:1019)

How do I fix this?

Here is the code I use to set up my AdView:

 SurfaceView view = new SurfaceView(this);

AdView v = new AdView(this, AdSize.BANNER, "my code");

v.loadAd(new AdRequest());

RelativeLayout e = new RelativeLayout(this);

e.addView(view);

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);

params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);

v.setLayoutParams(params);

e.addView(v);

setContentView(e);

相关阅读:
Top