Error while Displaying inMobi Ads on Android
I am Getting errors (on both simulator and Phone) while trying to get InMobi to work. Have done what the site says. Checked and rechecked all java, manisfest et al files.
The LogCat says it's Unknown Host exception!
Any guesses?
Mnanifest file:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk android:minSdkVersion="7"></uses-sdk>
</manifest>
Java code file:
adView = (InMobiAdView) findViewById(R.id.adview);
adView.initialize(this.getApplicationContext(), this, this, InMobiAdDelegate.INMOBI_AD_UNIT_320X48);
adView.loadNewAd();
adRefreshTimer = new Timer();
adRefreshTimer.schedule(new InMobiAdRefreshTimerTask(), adRefreshTime, adRefreshTime);
//all methods implemented as defined in the sample code. Including the correct siteID.
// the test mode code is below. Tried both true and false. None works.
@Override
public boolean testMode() {
// TODO Auto-generated method stub
return false;
}
Getting following error (pasting all of it). :
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): Exception retrieving ad
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): com.inmobi.androidsdk.impl.net.ConnectionException: Error posting data over connection
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.net.RequestResponseManager.postData(RequestResponseManager.java:118)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.net.RequestResponseManager.requestAd(RequestResponseManager.java:52)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.InMobiAdView.fetchAndDisplayAd(InMobiAdView.java:206)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.InMobiAdView.access$4(InMobiAdView.java:179)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.InMobiAdView$3.call(InMobiAdView.java:292)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.InMobiAdView$3.call(InMobiAdView.java:1)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at android.os.Handler.handleCallback(Handler.java:587)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at android.os.Handler.dispatchMessage(Handler.java:92)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at android.os.Looper.loop(Looper.java:123)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.BackgroundWorker$1.run(BackgroundWorker.java:36)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at java.lang.Thread.run(Thread.java:1096)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): Caused by: java.net.UnknownHostException: Host is unresolved: w.sandbox.mkhoj.com:80
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at java.net.Socket.connect(Socket.java:1038)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.sendRequest(HttpURLConnectionImpl.java:1325)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequestInternal(HttpURLConnectionImpl.java:1656)
04-01 13:35:48.381: ERROR/inmobi开发者_StackOverflow社区androidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequest(HttpURLConnectionImpl.java:1649)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:1248)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): at com.inmobi.androidsdk.impl.net.RequestResponseManager.postData(RequestResponseManager.java:115)
04-01 13:35:48.381: ERROR/inmobiandroidwebsdk(286): ... 12 more
04-01 13:35:49.380: VERBOSE/(286): inmobi ad request failed
Are you still getting this error? The hostname is now available and pointing to a proper CNAME. If you are still getting the error - i would suggest write to helpdesk@inmobi.com
; <<>> DiG 9.6.0-APPLE-P2 <<>> w.sandbox.mkhoj.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45784
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;w.sandbox.mkhoj.com. IN A
;; ANSWER SECTION:
w.sandbox.mkhoj.com. 3600 IN CNAME w.sandbox.inmobi.com.
w.sandbox.inmobi.com. 3600 IN CNAME sandbox.vip.er1.inmobi.com.
sandbox.vip.er1.inmobi.com. 3600 IN A 83.138.173.62
I work for InMobi. Our testing / sandbox address is w.sandbox.mkhoj.com
Two things to check
- Get the latest code from http://developer.inmobi.com/wiki
- Make sure you're not using an advert-blocker. If you have installed one - or are using a ROM with adblock capabilities, you won't be able to see our adverts.
Hope that helps
精彩评论