New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Picasso 2.5.2 Caching not working when custom downloader is defined #1185
Comments
Everything looks fine. How are you determining that the cache isn't working? |
Hi Jake, I am using the indicators which always are green or red, but never yellow. The following scenario is also indicating that there's a problem. |
Do the images have proper cache headers? Is the interceptor affecting their ability to be cached? |
The image request have the following response headers:
And the following request headers:
The interceptor should not affect the ability to cache. The interceptors only responsibility is to check whether the request returns Unauthorized and if so fetch a new token and redo the request. All of the image request URLs have the following structure:
The parameters of the URL changes over time, but does this affect the caching? |
I have the same problem. Is there a solution? |
I don't know what might be the issue with your code, but one thing you might want to do for debugging this sort of things is to change the cache folder to say a publicly available folder on sdcard (or if you have rooted device then I think it's a matter of determining the path to the cache folder and elevating to root access on adb). Then you can easily do something like: If at least something gets cached then you should see something like this: |
Hi, I have exact the same problem. |
I have the same problem with okhttp 2.7.5 edit:
|
Hate to pile onto this thread, but this is still an issue with Picasso 2.5.2 + OkHttp 3.4.1. FWIW, here are my response headers:
|
* First Android Studio cleanup * Removed unused imports * Class structure, fields can be local * Simplified equals() return * Java language level migration aids * Fixed Javadoc issues * Redundant initializer * Removed redundant initializers * Not annotated method overrides method annotated with @nonnull * Performance issues StringBuilder can be replaced with String * Statements with empty body * argsValues is never null * Improved updater Simplified logic. Fixed dereference of 'channel' may produce 'java.lang.NullPointerException'. * Fixed getPath() may produce 'java.lang.NullPointerException' Removed unneded try * Fixed ignored method results * Use "L" to indicate a long value * oneway to interface method * Removed redundant character escape * Redundant variable declaration * Declaration acces can be weaker, changed to private * Redundant and unused throws clause * Fixed Javadoc after redundant and unused throws clause fixes * Return value of the methods are never used, fixed Javadoc * Remove unnecessary throws declarations * Method always return 1 Moved to a public static variable * CPU_ABI is deprecated, aded compat util classes * Fixes for locale deprecation * Fixes for getAllNetworkInfo() deprecation * Simplified return * Fix for Settings.System.ANDROID_ID deprecation * Fix for 'getDrawable(int)' is deprecated * CPU_ABI is deprecated * Fix for 'getDrawable(int)' is deprecated * Fix for deprecated decode * Removed Locales from compat Moved to LocaleUtils * Fixed deprecations for StatFs * Unused import * Simplified return * Boolean method 'isAdded' is always inverted * Field converted to local * Performance: used SparseArray instead of HashMap * Ellipsis string can be replaced with ellipsis character * Fields requires API level 16 (current min is 15) * Butterknife update * Fix apk build With gradle => 2.2 the apks are generated aligned so we need this changes to assemble the apks correctly to be found by the Jenkins archiving post-built step. * Java language migration aids * Unused imports * Unchecked cast * Simplified and improved Updater Using the parser is faster than using a POJO with fromJson * Jackson as JSON parser Added dep in build file and POJOS to deserialize the movies JSON, it is tons of times faster than GSON. * Removed updater POJO We parse the JSON directly with the Jackson parser because is very small and simple. * Removed invalid lines from manifest, meta-data for API < 16 compat * Removed NameValuePair * We separate the media response treatment for each media provider * MediaProvider acts as a really base provider for Media We move all implementation to the superclass, now the code is more clear. * Primitive type can not be nullable * Lazy initialization of subs provider * Removed GSON dep * Methods can not be nullable, optional instead * Simplified catch for all exceptions * Return the default static navigation index * member variables to local * Removed unused method * Removed unused method, modified access to inner classes * Modified acces to getVideoPlayerApps to package, format with language * Simplified catch, modified accesses * Missing ACCESS_WIFI_STATE permission * Proper Media.Torrent initialization * Inheritance is cool * Removed Created for Javadoc * Fix for access to member variables * Known if the app is in debug mode * Picasso image loading modifications We use fit instead resize the image, is faster. We set the default image as the placeholder when loading a new image. * Better Picasso initialization * Cancel previous Picasso requests before a new one * Prevent NPE when no image poster * Added missing deleted check and URL rewrite for fantart * Picasso improvements MemoryPolicy.NO_CACHE - We do not cache images on memory to avoid big memory consumption centerCrop - Scale the image honoring the aspect ratio until it fills the size. Crop either the top and bottom or left and right so it matches the size exactly. * Updated butterknife dep for mobile module * Removed the placeholder due to unexpected results on scrolling * debugable != BuildConfig.DEBUG, fixed cacheSize type, increased cache * Removed unused import * Removed the custom downloader for Picasso due to cache troubles square/picasso#1185 * Each provider uses an own tag for request instead of the default * Each provider cancels their own requests * We clear old items before change genere. Member variables to local. Removed deprecated methods. * Force the getMediaCallTag method impl for all MediaProvider subclasses * Fixed deprecation * Fix #20 Removed genre comparision To solve the load of not initialized fragments on change genre we always load the results because does not affect performance and ensure that the movies with that genre are loaded into the MediaListFragment when we clicked on the navigation item * Removed GSON reference * Fixed onAttach(Activity activity) deprecation warning * Simplified isLoading return, fixed getPosition deprecation warning, modified acceses
* First Android Studio cleanup * Removed unused imports * Class structure, fields can be local * Simplified equals() return * Java language level migration aids * Fixed Javadoc issues * Redundant initializer * Removed redundant initializers * Not annotated method overrides method annotated with @nonnull * Performance issues StringBuilder can be replaced with String * Statements with empty body * argsValues is never null * Improved updater Simplified logic. Fixed dereference of 'channel' may produce 'java.lang.NullPointerException'. * Fixed getPath() may produce 'java.lang.NullPointerException' Removed unneded try * Fixed ignored method results * Use "L" to indicate a long value * oneway to interface method * Removed redundant character escape * Redundant variable declaration * Declaration acces can be weaker, changed to private * Redundant and unused throws clause * Fixed Javadoc after redundant and unused throws clause fixes * Return value of the methods are never used, fixed Javadoc * Remove unnecessary throws declarations * Method always return 1 Moved to a public static variable * CPU_ABI is deprecated, aded compat util classes * Fixes for locale deprecation * Fixes for getAllNetworkInfo() deprecation * Simplified return * Fix for Settings.System.ANDROID_ID deprecation * Fix for 'getDrawable(int)' is deprecated * CPU_ABI is deprecated * Fix for 'getDrawable(int)' is deprecated * Fix for deprecated decode * Removed Locales from compat Moved to LocaleUtils * Fixed deprecations for StatFs * Unused import * Simplified return * Boolean method 'isAdded' is always inverted * Field converted to local * Performance: used SparseArray instead of HashMap * Ellipsis string can be replaced with ellipsis character * Fields requires API level 16 (current min is 15) * Butterknife update * Fix apk build With gradle => 2.2 the apks are generated aligned so we need this changes to assemble the apks correctly to be found by the Jenkins archiving post-built step. * Java language migration aids * Unused imports * Unchecked cast * Simplified and improved Updater Using the parser is faster than using a POJO with fromJson * Jackson as JSON parser Added dep in build file and POJOS to deserialize the movies JSON, it is tons of times faster than GSON. * Removed updater POJO We parse the JSON directly with the Jackson parser because is very small and simple. * Removed invalid lines from manifest, meta-data for API < 16 compat * Removed NameValuePair * We separate the media response treatment for each media provider * MediaProvider acts as a really base provider for Media We move all implementation to the superclass, now the code is more clear. * Primitive type can not be nullable * Lazy initialization of subs provider * Removed GSON dep * Methods can not be nullable, optional instead * Simplified catch for all exceptions * Return the default static navigation index * member variables to local * Removed unused method * Removed unused method, modified access to inner classes * Modified acces to getVideoPlayerApps to package, format with language * Simplified catch, modified accesses * Missing ACCESS_WIFI_STATE permission * Proper Media.Torrent initialization * Inheritance is cool * Removed Created for Javadoc * Fix for access to member variables * Known if the app is in debug mode * Picasso image loading modifications We use fit instead resize the image, is faster. We set the default image as the placeholder when loading a new image. * Better Picasso initialization * Cancel previous Picasso requests before a new one * Prevent NPE when no image poster * Added missing deleted check and URL rewrite for fantart * Picasso improvements MemoryPolicy.NO_CACHE - We do not cache images on memory to avoid big memory consumption centerCrop - Scale the image honoring the aspect ratio until it fills the size. Crop either the top and bottom or left and right so it matches the size exactly. * Updated butterknife dep for mobile module * Removed the placeholder due to unexpected results on scrolling * debugable != BuildConfig.DEBUG, fixed cacheSize type, increased cache * Removed unused import * Removed the custom downloader for Picasso due to cache troubles square/picasso#1185 * Each provider uses an own tag for request instead of the default * Each provider cancels their own requests * We clear old items before change genere. Member variables to local. Removed deprecated methods. * Force the getMediaCallTag method impl for all MediaProvider subclasses * Fixed deprecation * Fix #20 Removed genre comparision To solve the load of not initialized fragments on change genre we always load the results because does not affect performance and ensure that the movies with that genre are loaded into the MediaListFragment when we clicked on the navigation item * Removed GSON reference * Fixed onAttach(Activity activity) deprecation warning * Simplified isLoading return, fixed getPosition deprecation warning, modified acceses * Removed the JsonProperty annotation from getters and setters * Port to dagger * Fixed the Url getter for Torrent object * Fixed setOnTabSelectedListener deprecation warning * Handle holder visibility if the Item is a VPNNavDrawerItem * Fixed getColor deprecation warnings * Added missing nullable import during merge
@vickychijwani @HolyPick @shamo42 @ilyamuromets If some one still have this issue try to set cache for OkHttpClient
Also important thing. Add fit() to load request |
i tried below but it didn't worked.
i am still facing the same issue when the application is started then the images are fetched and cached by Picasso but when the application is killed and then if i use flight mode and started the app then Picasso is not reloading the images from cache. |
I can't get the disk cache to work in Picasso 2.5.2. I have the following relevant dependencies:
In my application class i am creating an OkHttpClient(), setting the cache and the Picasso instance.
My CacheUtils class:
Afterwards i am using Picasso the following way:
I can't figure out what i am doing wrong but the images does not seem to be loaded from the disk cache. If i close the app and open it again the image is loaded from the network or the memory cache.
If i remove the downloader from the Picasso config then the cache works as expected.
Can anyone help me and tell me what i might be doing wrong?
The text was updated successfully, but these errors were encountered: