在我crashLytics報告相關地址:非致命異常:的java.net.UnknownHostException無法解析主機「mysite.com」:沒有與主機名
java.net.UnknownHostException: Unable to resolve host "mobile.site.com": No address associated with hostname
at java.net.InetAddress.lookupHostByName(InetAddress.java:394)
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
at java.net.InetAddress.getAllByName(InetAddress.java:214)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
at com.spmkt.mobile.action.FormDAO.uploadFormsWithoutPics(SourceFile:70)
at com.spmkt.mobile.action.FormDAO.uploadFormsWithPics(SourceFile:171)
at com.spmkt.mobile.BaseActivity.sync_total(SourceFile:274)
at com.spmkt.mobile.BaseActivity$1.run(SourceFile:170)
at java.lang.Thread.run(Thread.java:856)
我猜它出現在我的服務器關閉時,或者當android檢測到互聯網連接時,但質量非常糟糕,無法連接。
是否可以防止這種異常?
你忘了同樣的錯誤在你的網址開頭添加「http://」? –
不,我包含http://,它隨機發生,有時我有一個偷看 –
聲音像連接是如此糟糕,以至於DNS請求的答案在傳輸中丟失。檢查DNS條目是否意外地有一個短的超時期限,因此查找必須重複。 –