java.net.UnknownHostException Unable to resolve host "accounts.google.com": No address associated with hostname while inserting rows in bigquery

14,657

Solution 1

This Exception Thrown to indicate that the IP address of a host could not be determined.

This exception is also raised when you are connected to a valid wifi but router does not receive the internet. Its very easy to reproduce this:

Connect to a valid wifi Now remove the cable from the router while router is pluged-in

You will observe this error!!

You can't really solve this, You can only notify the user gracefully. (something like - "Unable to make a connection")

also make sure you have added the permission in AndroidManifest.xml.

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

Solution 2

Have you added the INTERNET permission to your manifest file.

If not, add below line outside the application tag in your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" /> 
Share:
14,657

Related videos on Youtube

N Sharma
Author by

N Sharma

I have done masters in Advanced Software Engineering. I have worked on various technologies like Java, Android, Design patterns. My research area during my masters is revolving around the Recommendation algorithms that E-commerce websites are using in order to recommend the products to their customers on the basis of their preferences.

Updated on June 04, 2022

Comments

  • N Sharma
    N Sharma almost 2 years

    Hi I am working on android app in which I have integrated BigQuery. I see we are getting a lot of exception sometimes while inserting records in BigQuery tables. We are not expertise in this but started to learn this new technology. It would be great if you guys can help me on this.

       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.a.a.c.a.c.a(NetHttpRequest.java:77)
              at com.google.a.a.c.r.p(HttpRequest.java:972)
              at com.google.a.a.a.a.h.a(TokenRequest.java:307)
              at com.google.a.a.b.a.a.b.f(GoogleCredential.java:384)
              at com.google.a.a.a.a.c.h(Credential.java:489)
              at com.google.a.a.a.a.c.a(Credential.java:217)
              at com.google.a.a.c.r.p(HttpRequest.java:859)
              at com.google.a.a.b.d.c.c(AbstractGoogleClientRequest.java:469)
              at com.test.utils.c.c(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.a.a.c.a.c.a(NetHttpRequest.java:77)
              at com.google.a.a.c.r.p(HttpRequest.java:972)
              at com.google.a.a.a.a.h.a(TokenRequest.java:307)
              at com.google.a.a.b.a.a.b.f(GoogleCredential.java:384)
              at com.google.a.a.a.a.c.h(Credential.java:489)
              at com.google.a.a.a.a.c.a(Credential.java:217)
              at com.google.a.a.c.r.p(HttpRequest.java:859)
              at com.google.a.a.b.d.c.c(AbstractGoogleClientRequest.java:469)
              at com.test.utils.c.c(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)
    
    • Mimmo Grottoli
      Mimmo Grottoli
      How is your device connected to Internet? Mobile? WiFi? Do you have any proxy?
  • Arpit Aggarwal
    Arpit Aggarwal over 8 years
    Are you able to got to accounts.google.com on your machine in a browser?