I need to expose some Picasso resources to satisfy a rather strange request. For this I need to import Picasso as a library project instead of a compiled jar. I've created a new Android Project and copied the contents of picasso\picasso\src\main\java (cloned master) to the src folder. Picasso uses OkHttp so I downloaded the latest release jar (2.3.0) and put it in the libs folder of the Picasso project; added it to the build path; selected the jar in the build path "Order and Export" preferences. Finally, I made the Picasso project a library and included it in the main project (also removed the old Picasso jar from libs).
The first time the application tries to make a Picasso request I get the following exception:
04-12 17:04:15.956: E/AndroidRuntime(5436): java.lang.NoClassDefFoundError: com.squareup.okhttp.internal.DiskLruCache$4 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.okhttp.internal.DiskLruCache.<clinit>(DiskLruCache.java:810) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.okhttp.Cache.<init>(Cache.java:168) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:77) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:55) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.picasso.OkHttpDownloader.<init>(OkHttpDownloader.java:45) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.picasso.Utils$OkHttpLoaderCreator.create(Utils.java:424) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.picasso.Utils.createDefaultDownloader(Utils.java:250) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.picasso.Picasso$Builder.build(Picasso.java:832) 04-12 17:04:15.956: E/AndroidRuntime(5436): at com.squareup.picasso.Picasso.with(Picasso.java:662)
The specified class seems to be in the jar but DiskLruCache.java seems broken into a total of 9 class files:
$ ls DiskLruCache* DiskLruCache$1.class DiskLruCache$4.class DiskLruCache$Entry.class DiskLruCache$2.class DiskLruCache$Editor$1.class DiskLruCache$Snapshot.class DiskLruCache$3.class DiskLruCache$Editor.class DiskLruCache.class
I'm ready to provide additional info. Any advice would be highly appreciated.
Edit:
The problem seems to be in the OkHttp jar. I've tried to import it in the main project along with the Picasso jar (latest - 2.5.2) and I get the same exception. I do not see any OkHttp warnings, indicating incompatibility as stated in some other threads.