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: 

okhttp not found, migrating to Android developer studio (gradle)

okhttp not found, migrating to Android developer studio (gradle)

swright1512
Explorer | Level 3

I have an application that i have not needed to update since moving to API v2 in 2017.  Due to google enforcing a minimum targetSDK i have made modifications and the project now meets the target and is backward compatible to API 8 in eclipse.

 

I am trying now to migrate the eclipse project over to ADS. I have to admit that I have no prior experience until the last few days of ADS and gradle, so please be gentle!

 

 

when i build my app i am getting the following error

 

 

cannot access OkHttpClient class file for com.squareup.okhttp.OkHttpClient not found

 

 

C:\test\testproject\src\main\java\com\dropbox\core\examples\android\PicassoClient.java:19: error: cannot access OkHttpClient
                .downloader(new OkHttpDownloader(context))

 

i have the .jar file for okhttp in libs folder (same files that build ok with eclipse).

 

i have tried adding dependency so gradle downloads but it fails to find it.

 

implementation 'com.squareup.okhttp3:3.8.1'

and

implementation 'com.squareup.okhttp3:3.0.1'

 

Any help would be appreciated.

 

 

 

 

my build.gradle

 

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
useLibrary 'org.apache.http.legacy'

defaultConfig {
applicationId "com.test.testproject"
minSdkVersion 14
targetSdkVersion 28
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}

dependencies {
implementation files('libs/okio-1.13.0.jar')
implementation files('libs/okhttp-3.8.1.jar')
//implementation 'com.squareup.okhttp3:3.8.1'
implementation files('libs/picasso-2.5.2.jar')
implementation files('libs/dropbox-android-sdk.jar')
implementation files('libs/dropbox-core-sdk-3.0.3.jar')
implementation files('libs/httpmime-4.0.3.jar')
implementation files('libs/jackson-core-2.7.4.jar')
implementation files('libs/json_simple-1.1.jar')
implementation fileTree(dir: 'C:\\android\\support\\v7\\appcompat\\libs', include: ['*.aar', '*.jar'], exclude: [])
}

 

 

11 Replies 11

swright1512
Explorer | Level 3
The reason I used that code and library versions is because the exact same code and library build OK in the existing project with eclipse.

Will the latest versions be OK with minimum SDK version 8?

Greg-DB
Dropbox Staff

The Android example app only supports SDK 19 and up. The Dropbox library itself doesn't have a documented minimum supported Android SDK level, but I would expect it to work on any SDK level where its dependencies can work. 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    swright1512 Explorer | Level 3
What do Dropbox user levels mean?