Showing results for 
Show  only  | Search instead for 
Did you mean: 
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

Showing results for 
Show  only  | Search instead for 
Did you mean:

Explorer | Level 4

Unable to resolve host "": No address associated wi

5 Replies 5



@TejaVarma It looks like you didn't post the entirety of the issue. Can you share the code and full output that's giving you trouble?


Based on what you did post though, it looks like you're getting a UnknownHostException for


Per the documentation for this error indicates:


"... that the IP address of a host could not be determined."


So, it sounds like you may be having DNS issues, preventing you from resolving the Dropbox API servers. The Dropbox API servers are resolving correctly though, so this sounds like an issue with your network connection.


Is there any reason your app might not be able to resolve the Dropbox API servers? For example, I recommend checking any firewall, proxy, or security software that may be interfering with your network connection. Likewise, you may need to check that your DNS server is working properly.


Explorer | Level 4

Here is code 


String urlToken = "";
String charset = "UTF-8"; // Or in Java 7 and later, use the constant:
String query = String.format("grant_type=authorization_code&%s&code=%s&client_id=%s&client_secret=%s",
URLEncoder.encode(authCode, charset),
URLEncoder.encode(APP_KEY, charset),
URLEncoder.encode(APP_SECRET, charset));
Log.d(LOG_TAG, "getInputStreamAsString()");
String inputStreamAsString = AccountsManager.getInputStreamAsString(urlToken, charset, query);

String result = "";
URL url = new URL(urlStr);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();

// Create the SSL connection
/*SSLContext sc;
sc = SSLContext.getInstance("TLS");
sc.init(null, null, new;

// set Timeout and method
conn.setDoOutput(true); // Triggers POST.

conn.setRequestProperty("Content-Language", "en-US");
conn.setRequestProperty("Accept-Charset", charset);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// conn.setRequestProperty("Content-Length", "" + Integer.toString(_charset.getBytes().length));

OutputStream os = conn.getOutputStream();


String err = new String();
InputStream errStream = conn.getErrorStream();
BufferedReader errReader = new BufferedReader(new InputStreamReader(errStream));
String eLine;
while ((eLine = errReader.readLine()) != null) {
err += eLine;
Log.e(LOG_TAG, "ERROR : " + err);

Log.d("", "getInputStreamAsString() : responseCode: " + conn.getResponseCode() +
"response message : " + conn.getResponseMessage());

//read the inputStream into a string
result = new String();
InputStream is = conn.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));
String inputLine;
while ((inputLine = in.readLine()) != null) {
result += inputLine;
} catch (Exception e) {
Log.w("", "Exception thrown " + e.getMessage());
throw new UnsupportedOperationException("TODO : handle this");

Most of the time code is working fine. But Some time I am getting error.



Thanks! By the way, it looks like you're not using the official Dropbox API v2 Java SDK. We do highly reccomend using it, if possible.


In any case, whether or not you're using it, it does just look like this error is due to intermittent DNS issues, so you should look into why your DNS queries may be failing occasionally.


Explorer | Level 4


I am using Dropbox API v2 libary, instead of using Auth, I am using API directly.  I cahnged url from v1 to v2. From this url 


I changed url /1/oauth2/token to /oauth2/token


Right now it is working fine. By changing WIFI settings. If I face same problem I will let you know.


Please confirm weather I am using correct URL of V2 or not?


Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    TejaVarma Explorer | Level 4
What do Dropbox user levels mean?
Need more support?