cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

Java API - V2

Java API - V2

RTS S.
Helpful | Level 6

I am trying to ugrade my Android App to V2. I have added the new API to the Eclipse Project using the Maven dependency.

There appears to be a dependency on SquareOK.com that I am not getting. 

When I call:  

 

DbxClientV2 GetClient(String Token) {0
  String userLocale = Locale.getDefault().toString();
  DbxRequestConfig requestConfig = new DbxRequestConfig("examples-v2-demo", userLocale, OkHttpRequestor.Instance);
  return new DbxClientV2(requestConfig, Token);
}

I successfully received a token from: 

      String token = Auth.getOAuth2Token();

And used that to call the above function.

I am getting the following ClassPath loading error:

01-20 08:32:15.350: I/Timeline(22716): Timeline: Activity_idle id: android.os.BinderProxy@37d705b8 time:21337241
01-20 08:33:02.646: E/AndroidRuntime(22716): FATAL EXCEPTION: pool-1-thread-1
01-20 08:33:02.646: E/AndroidRuntime(22716): Process: com.rtsservices.test, PID: 22716
01-20 08:33:02.646: E/AndroidRuntime(22716): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/OkHttpClient;
01-20 08:33:02.646: E/AndroidRuntime(22716): at com.dropbox.core.http.OkHttpRequestor.defaultOkHttpClient(OkHttpRequestor.java:36)
01-20 08:33:02.646: E/AndroidRuntime(22716): at com.dropbox.core.http.OkHttpRequestor.<clinit>(OkHttpRequestor.java:47)
01-20 08:33:02.646: E/AndroidRuntime(22716): at com.rtsservices.Accounts.GetClient(Accounts.java:104)

 

 

3 Replies 3

Greg-DB
Dropbox Staff

Hi RTS, if you want to use OkHttp, you'll need to add it to your project, as noted here. It's only specified with the "provided" scope by the SDK's pom.xml.

RTS S.
Helpful | Level 6

I have already added this .. to solve my problem ... but why is it marked provided ?

Your software has a dependency on it. 

Provided is typically for things that are provided by the run time environment like JDK or things that may need a license.

Your install notes should state that this needs to be installed, and/or this provided line should be changed to compiled (the default).

 

Greg-DB
Dropbox Staff

That's marked provided because it isn't strictly necessary when using the SDK. It's just an optional alternative to the standard HttpRequestor.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    RTS S. Helpful | Level 6
What do Dropbox user levels mean?