java.net.UnknownHostException无法parsing主机“accounts.google.com”:在bigquery中插入行时没有与主机名关联的地址

嗨,我正在Android应用程序,我已经集成了BigQuery。 我发现在BigQuery表中插入logging时,我们有时会遇到很多exception。 我们不是这方面的专业知识,而是开始学习这项新技术。 如果你们能帮助我,这将是非常好的。

java.net.UnknownHostException: Unable to resolve host "accounts.google.com": No address associated with hostname at java.net.InetAddress.lookupHostByName(InetAddress.java:424) at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) at java.net.InetAddress.getAllByName(InetAddress.java:214) at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28) at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216) at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292) at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197) at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254) at com.google.aacaca(NetHttpRequest.java:77) at com.google.aacrp(HttpRequest.java:972) at com.google.aaaaha(TokenRequest.java:307) at com.google.aabaabf(GoogleCredential.java:384) at com.google.aaaach(Credential.java:489) at com.google.aaaaca(Credential.java:217) at com.google.aacrp(HttpRequest.java:859) at com.google.aabdcc(AbstractGoogleClientRequest.java:469) at com.test.utils.cc(CommonUtility.java:2730) at com.test.services.AppInstallIntentService.onHandleIntent(AppInstallIntentService.java:71) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61) Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname) at libcore.io.Posix.getaddrinfo(Posix.java) at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61) at java.net.InetAddress.lookupHostByName(InetAddress.java:405) at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) at java.net.InetAddress.getAllByName(InetAddress.java:214) at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28) at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216) at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292) at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197) at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254) at com.google.aacaca(NetHttpRequest.java:77) at com.google.aacrp(HttpRequest.java:972) at com.google.aaaaha(TokenRequest.java:307) at com.google.aabaabf(GoogleCredential.java:384) at com.google.aaaach(Credential.java:489) at com.google.aaaaca(Credential.java:217) at com.google.aacrp(HttpRequest.java:859) at com.google.aabdcc(AbstractGoogleClientRequest.java:469) at com.test.utils.cc(CommonUtility.java:2730) at com.test.services.AppInstallIntentService.onHandleIntent(AppInstallIntentService.java:71) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61) 

Solutions Collecting From Web of "java.net.UnknownHostException无法parsing主机“accounts.google.com”:在bigquery中插入行时没有与主机名关联的地址"

抛出此exception以指示无法确定主机的IP地址。

当你连接到一个有效的无线networking,但路由器没有收到互联网时,也会引发这个exception。 它很容易重现这一点:

连接到一个有效的WiFi现在,当路由器插入时,从路由器上拔下电缆

你会观察这个错误!

你不能真正解决这个问题,你只能优雅地通知用户。 (类似 – “无法build立连接”)

还要确保你已经在AndroidManifest.xml添加了权限。

 <uses-permission android:name="android.permission.INTERNET" /> 

你有没有添加INTERNET权限到你的清单文件。

如果没有,请在AndroidManifest.xml的应用程序标签之外添加以下行:

 <uses-permission android:name="android.permission.INTERNET" />