Some image not show on android , with unknown image format in logcat.

Please provide the following:

  1. SDK Version:48.0.6
  2. Platforms(Android/iOS/web/all):Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Anyone ever encounter “unknown image format, {uri: file:///data/user/0/com.myapp/cache/ExponentAsset-4a064ee1c5400224d513855ed69128f6.png, firstEncodedBytes: 3C3F786D6C2076657273, length: 275}”(log from logcat) error? Which lead to some image not showed.

or anyone can provide a proper way to clear cache on file:///data/user/0/com.myapp/cache/Expone… path? I tried reinstall app and expo clear cache but none are working.

Hi @matanume

Make sure that all of your .png files are actually PNGs. If you’re on Linux or macOS you can use the file command to check the file type.

Do you have any files in your app with a .png extension that are 275 bytes in size? If so, that is probably the one that it’s complaining about in the message you quoted.

Ah, I’ve just checked what those “firstEncodedBytes” are. That looks like a hexadecimal string. If you decode it you get:

<?xml vers

So it seems that somehow your file actually contains XML instead of a PNG. I suspect it’s actually an SVG. You’ll either need to convert it to a PNG or arrange for the SVG to be loaded and displayed.

One option if you want to do this is react-native-svg-transformer - npm
Another is to convert the SVG to JSX using something like SVGR

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.