Home > Back-end >  I can't display images in my apk release in flutter
I can't display images in my apk release in flutter

Time:06-12

I have created an app in flutter and when I test it on my mobile it does not show any image. Everything is fine, except the images.

I attach a picture of the pubspec.yaml, as I have the structure of assets and the cmd of how I create the apk. Each name in the images is a folder in which there are images inside.

I clarify that in Visual Studio Code that is where I have done it, in its emulator if the images are shown, but when I install the apk, no.

It is curious that if I add - assets/images/Atreus/ , when creating the apk, this weighs more (as it weighs more for that folder I added), but still not shown.

Thanks.

pubspec.yaml

structure assets

cmd


ADD: I have already fixed the red warning. It creates the apk without those warnings (I updated jdk to 15 and gradle to version 7.0.2), but the images are still not visible.

build apk

CodePudding user response:

the cmd told you that you need to update your gradel

CodePudding user response:

Subdirectories within a directory are not automatically included. You need to include every directory in your pubspec.yaml. Not sure how things worked on the emulator without this. So you would have (according to your asset structure):

  assets:
    - assets/images/Antiguo
    - asests/images/Aparicion
    ...

Do a flutter clean and try building again.

  • Related