Can't add Okhttp dependency with Estimote SDK

Hello everyone,

I’m triying to add Okhttp library to my Android project, which uses Estimote Android SDK. It seems that the Estimote Android SDK has included that library (an older version), but the problem is that other dependencies I have included to my app (like Picasso) can’t access to that dependencies, just my own classes can. Picasso, to initialize the image caching system, needs to instantiate OkhttpClient object by his own and this class can be found in the Okhttp library. But, it seems that a dependency can’t access to another dependencies’ library. I don’t know how to explain it…

If I add the Okhttp dependency to my Gradle, after 7 minutes of building, the build fails with a “dexDebug” error. That means that the same library is included twice (one in the Estimote SDK and other in my Gradle).

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile ''
    compile ''
    compile ''
    compile ''
    compile ''
    compile ''
    compile ''
    //compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'joda-time:joda-time:2.8.1'
    compile ''
    compile files('libs/FlurryAnalytics-5.6.0.jar')
    compile(name: 'estimote-sdk', ext: 'aar') // This library has okhttp 2.2.0 included in it, but Picasso library can't access here...

Any ideas how to solve it? Maybe I can make something in the Gradle file, but I don’t know what can I do…

Thank you very much.

Yes, we do include OkHttp but library is repackaged (into package so there should be no collision at all.

You would have two OkHttpClient classes:
and com.squareup.okttp.OkHttpClient
and that’s perfectly fine. With Picasso you need to use the second one.

What’s the exact error you are seeing?


Thanks for your reply. Now I’m trying to use the library included from Maven Central but I get the same error.

Picasso.Builder builder = new Picasso.Builder(this);
OkHttpDownloader downloader = new OkHttpDownloader(this, Integer.MAX_VALUE); 
// OkHttpDownloader is a Picasso's class, and then this needs OkHttpClient object from OkHttp library. But it seems that a library can't access to Estimote's library.

Picasso built =;


OkHttpDownloader is a Picasso’s class, and to instantiate this class I need to include OkHttp dependency. But, if I do that, the project won’t compile because Estimote’s library also has an OkHttp dependecy in it and colides with my OkHttp dependency. The thing is that OkHttpDownloader class (that’s inside Picasso’s library) needs to instantiate a OkHttpClient object, that is found in OkHttp library, and Picasso can’t reach the OkHttp library which is in Estimote dependency.

Thanks for your reply.

Happy coding.

Please check attached working Android-SDK’s Demos project with Picasso+OkHttp setup.
Unpack and run “./gradlew installDebug”.

I modified build.gradle to include:

  compile 'com.squareup.picasso:picasso:2.5.2'
  compile 'com.squareup.okhttp:okhttp:2.4.0'

And in AllDemosActivity:

    ImageView imageView = (ImageView) findViewById(;

    Picasso picasso = new Picasso.Builder(getApplicationContext()).loggingEnabled(true)
        .downloader(new OkHttpDownloader(this, Integer.MAX_VALUE))


The reason I found it strange as that’s perfectly fine to have two OkHttpClient classes within two different packages. (1.4 MB)

Maybe that wasn’t crystal clear. Do not use OkHttpClient from Estimote SDK as it is our repackaged, private dependency which is subject to change without any notice.