exception: kotlin.IllegalArgumentException: Failed to Image::makeFromEncoded I am facing this crash...
q
exception: kotlin.IllegalArgumentException: Failed to Image::makeFromEncoded I am facing this crash on iOS whenever I use image ".png"... Any ideas?
l
I'd check the data array to see if it's empty. If it's not, then check that the data is correct. The png file format likely has a few bytes that are always at the start of the file.
q
Yup once I changed it to jepg everything worked fine... Thanks Landry
d
After adding new images in commonMain/resources. you should do this: •
cd iosApp
•
pod install
q
Yes I already did that, but still getting in ios the missing resources crash
d
q
Yes I am having the same structure but in somehow it didn't works with ios unless I put the images in iosApp folder
n
May you share with us original .png to check why it fails?
q
IMG_20230508_152719_542.jpg,IMG_20230508_152721_320.jpg
Those are jpeg and they works when i manually added them inside ios app
And this is the png which is didn't work at all even if i put it manually inside ios app
Nothing is auto added to my ios project when i run pod install command that's my issue.
n
It seems to be .jpg not .png
q
Yes, to let it work I have to cpnvert it to jpeg
n
Nothing is auto added to my ios project when i run pod install command that's my issue.
So can you share the whole project to check?
q
Sure
n
Yes, to let it work I have to cpnvert it to jpeg
Where we can find original .png?
q
I will push it now
To let you test
Check it now
IMG_20230508_153817_757.jpg
n
I see that you have custom iOS project configuration (not as in template we provide). For instance, Podfile does not reference "common" that is why resources are not copied automatically via pod install. You also have some manual resource copiing within xcode project that conflicts with pod resource copiing when I add a reference to "common". Now I can't make your project successfully compiling on my side for iOS
q
So I should replace common with shared then the resources will auto added to my ios project?
Actually this project is before IOS get alpha version
I was discovering how to start my compose in ios with it.
n
I would suggest to try our official template first, check that it works and then copy your code into it
q
Sure will try today šŸ™ thanks for your response
n
BTW, I have tried your Plants.png on our official template and is loaded ok with painterResource (after pod update in iosApp)
q
That is great, but it was causing this crash kotlin.IllegalArgumentException: Failed to Image::makeFromEncoded Is it showing with you?
n
No, there is no errors at all. The Plants.png is just loaded and shown successfuly on iOS
q
Ok this is awesome, i will try to figure out the differences between my project and the template hope I can make it work
n
image.png
q
Cool, Thanks a lot for clarifying it all
n
And I think the error you saw that you tried to copy .jpg into .png file manually and then tried to open that file which is in jpg format as .png and got the error (or vice versa).
q
Hello @Nikita Lipsky just to let you know that I made it work šŸ™ I check the pod configuration inside your template some were missed on mine once I add them everything works fine šŸ™šŸ«”
j
I'm also seeing that error (
exception: kotlin.IllegalArgumentException: Failed to Image::makeFromEncoded
) in following https://github.com/joreilly/GeminiKMP . I wasn't clear from above whether fix was some change to some code or config etc?
165 Views