dropbox / dropbox-sdk-java

A Java library for the Dropbox Core API.
https://www.dropbox.com/developers/documentation/java
MIT License
594 stars 450 forks source link

class file for okhttp3.OkHttpClient not found #126

Closed nickhma closed 6 years ago

nickhma commented 7 years ago

Gradle build error when creating DbxClientV2 (like in DropboxClientFactory):

Error:(13, 93) error: cannot access OkHttpClient
class file for okhttp3.OkHttpClient not found

I know this is solved by including OkHttp inside dependencies, but I just wanted to raise this issue because this is not clear from the Setup section on your README.

bazimogmbh commented 7 years ago

You should add the dependency of OkHttp, only if you explicitly want to use it. The dropbox cleint can be created wittout external dependency as following

    StandardHttpRequestor requestor = new StandardHttpRequestor(config);
    DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder(clientUserAgentId)
        .withHttpRequestor(requestor)
        .build();
    new DbxClientV2(requestConfig, auth.getAccessToken(), auth.getHost());
greg-db commented 7 years ago

That's correct, use of OkHttp is optional. I'll ask the team to clarify this in the README.

nickhma commented 7 years ago

Thank you!

AbandonedCart commented 6 years ago

You may want to update the samples, too. As of today (Oct 2, 2018), I landed here searching for a solution to the same issue when working with the sample code.

greg-db commented 6 years ago

@AbandonedCart Thanks! I'll make a note of that with the team as well.