Android decoder->decode returned false for Bitmap download

前端 未结 7 1685
不知归路
不知归路 2020-11-30 06:02

I\'ve started getting a

DEBUG/skia(xxxx): --- decoder->decode returned false 

issue on a few profile images from Facebook that I use in

7条回答
  •  暖寄归人
    2020-11-30 06:12

    Here is what the issue was for me:

    From the emulator I would save the jpg file locally (on the emulated sdcard) and then attempt to read it up and display it using decode on the emulator and it worked. Then, as a test, I copied the file (using adb pull) to my development (xp) machine and it would display using 'paint'. Then, from the emulator, I uploaded the file (via http post) to my win2003 server. Using 'paint' it displayed there as well. But when I downloaded it back to the emulator (via http get), it failed during the decode.

    Then I noticed that the file uploaded to the win2003 server was two bytes smaller than the original. Not totally sure how that happened because I've been using the same upload logic for years and never noticed the issue before. As a test, I simply appended two more random bytes during the upload so the file size was exactly the same. Then, when downloaded back to the emulator, it decoded and displayed properly.

    Just as a check, I appended two random bytes over on my xcode projects and then those jpg files also displayed on the android emulator as well.

    So, although the files which were two bytes smaller displayed everywhere else, they would not on the emulator. Apparently decode is doing some sort of CRC before it attemps to decode and decides it cannot continue. And hence the error.

提交回复
热议问题