0

I'm trying upload a photo to dropbox by the code:

public static void init(String accessToken) {
    if (sDbxClient == null)) {
        DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("ID")
                .withHttpRequestor(OkHttp3Requestor.INSTANCE)
                .build();

        sDbxClient = new DbxClientV2(requestConfig, accessToken);

    }

}

But i dont know what is OkHttp3Requestor and Android Studio don't find this symbol, anyone knows what is? And how to use to upload a picture?

Asif Patel
  • 1,744
  • 1
  • 20
  • 27
  • https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/http/OkHttp3Requestor.html Make sure it's imported – Ken Wolf Feb 17 '17 at 15:05
  • I imported this jar – lidia rocha Feb 17 '17 at 15:24
  • Make sure it's imported at the top of your class – Ken Wolf Feb 17 '17 at 15:25
  • was imported on the gradle, but in the auto-complet dont exist the suggest to import on the class – lidia rocha Feb 17 '17 at 16:08
  • It's also worth nothing that you don't need to use [`OkHttp3Requestor`](https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/http/OkHttp3Requestor.html) if you don't want to, e.g.: as shown in [this example](https://github.com/dropbox/dropbox-sdk-java/blob/7ecc15cf0f51d6ae2ba5cdb334aac2c2f3474b87/examples/web-file-browser/src/main/java/com/dropbox/core/examples/web_file_browser/Common.java#L135). The SDK will use its [`StandardHttpRequestor`](https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/http/StandardHttpRequestor.html) by default. – Greg Feb 17 '17 at 17:48

2 Answers2

0

Add this to grandle

compile 'com.squareup.okhttp3:okhttp:3.6.0'

You'll also need Okio, which OkHttp uses for fast I/O and resizable buffers. Download the latest JAR.

So add this as well:

compile 'com.squareup.okio:okio:1.11.0'
Sid
  • 14,176
  • 7
  • 40
  • 48
0

add this to build.gradle dependencies

implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'