question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoClassDefFoundError using Donwloader

See original GitHub issue

I am using a custom downloader por Picasso.

 private PicassoCache (Context context)  {

        Downloader downloader   = new OkHttpDownloader(context, Integer.MAX_VALUE);
        Picasso.Builder builder = new Picasso.Builder(context);
        builder.downloader(downloader);

        picassoInstance = builder.build();
    }

gradle

compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.squareup.okio:okio:1.10.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'

But no matter what I do, I always have this error:

 stack=java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/OkHttpClient;
             at com.squareup.picasso.OkHttpDownloader.defaultOkHttpClient(OkHttpDownloader.java:31)
             at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:76)
             at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:65)
             at ni.com.spiralni.help.utils.PicassoCache.<init>(PicassoCache.java:27)
             at ni.com.spiralni.help.utils.PicassoCache.getPicassoInstance(PicassoCache.java:43)
             at ni.com.spiralni.help.utils.ImageUtils.setImageFromWebStorage(ImageUtils.java:34)
             at ni.com.spiralni.help.adapter.SearchResultListRVAdapter.onBindViewHolder(SearchResultListRVAdapter.java:45)
             at ni.com.spiralni.help.adapter.SearchResultListRVAdapter.onBindViewHolder(SearchResultListRVAdapter.java:24)

Is there any issue with this integration?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
nishsvn-devcommented, Feb 2, 2017

Upon using OkHttp3Downloader, the issue solved for me.

1reaction
spiralnicommented, Oct 5, 2016

Thanks,

I did try changing to OkHttp3Downloader and using compile 'com.squareup.okhttp3:okhttp:3.4.1'

and the problem persists.

After tried a lot of combinations I found this:

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

Thanks for your time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoClassDefFoundError for a jar file downloaded at ...
The downloading of the jtapi.jar is initiated by the application itself. It downloads a new file for 1 of 2 reasons: (1) The...
Read more >
java.lang.NoClassDefFoundError - Download JAR files
Here you can download the dependencies for the java class java.lang.NoClassDefFoundError. Use this engine to looking through the maven repository.
Read more >
3 ways to solve java.lang.NoClassDefFoundError in Java J2EE
NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available at compile...
Read more >
How do I resolve a java.lang.NoClassDefFoundError error ...
So, in order to create the REST connection pool with the ODRESTAdmin.jar (which depends on jaxb-api.jar) with Java 11+, you need to download...
Read more >
Caused By: java.lang.NoClassDefFoundError: org/apache ...
NoClassDefFoundError : org/apache/log4j/Logger error in Java application. In most cases, this issue will go away as soon as you add the log4j.jar file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found