Search code examples
javaandroidpicasso

Picasso failure in Android Native Developing


I have an android application coded with Java in Android Studio. I published my Restful Api to web server. Whenever i open my android app, the pictures uploaded to the server can not be downloaded to the app via Picasso. Moreover I can not access these pictures under App_Data folder. Any solutions?


Solution

  • I want to share that answer in case someone needs it.

    The accessing problem to my pictures under the App_Data folder was caused by a missing virtual directory matching. First i created a virtual directory pointing to my pictures folder under App_Data. Second i tested whether i can access these pictures with chrome browser. if i typed the correct path with the new created virtual directory i can access via web browser.

    But the key issue is that i can not access these files again from my app. I found the reason by deep diving and analyzing.

    The actual problem is that: When i tried to access these files by my android app, Picasso assigns some mapping in its cache. which is under my android app folder. Because of this cache, no matter i fixed the virtual directory issue Picasso can not access them. Picasso only checks it's cache and if there is a 404 error for that file it doesn't try one more time. So at the and i completely uninstalled from the device and i installed it again. After that everything is fine!

    Edit:clearing picasso cache also works. But it must be used on similar conditions, otherwise clearing picasso cache can affect load times as well as internet usage.