DynamicComponents does not show the images in the compiled APK

Hello, I created a dynamic list in my APP using the DynamicComponents extension. The list includes a series of images.
The problem I have is that if I try the APP trough the Connect -> AI Companion, everything works fine and I can see the images perfectly in my phone's screen.
But if I create an APK and execute it directly instead of through the emulator, then the images are not shown. I know that the program is creating them because I can see its place in the screen (the screen space gets greater), but they seem to be transparent or something like that.
I attach two screenshots. Second one corresponds to the phone screen when I launch my APP thought the Connect->AI Companion. The first one is the shown when I launch the APP directly though the APK installed in the phone. The APP is exactly the same in both cases. Anyone has any idea about how could I solve this?
Thanks!


Where do the images come from (assets, ...) ?
And show the (relevant) blocks.

See also here:

Hi Anke,
thank you very much for your answer.
The images come from the media resources of the project. I uploaded the images there.
On the other hand, here you have the code that inserts the images dinamycally in the screen:


As I said before, everything works fine if I launch the app from the Connect -> AICompanion, but no image is show if I compile an APK, install it in the phone and execute it.
Thanks agains for your support!

I think you might like to ask the extension developer for advice. Can you tell us, in detail, why you are using the extension?

Which Android version does your (test) device have?

Try to remove the slashs from all image paths:

Because I need to insert components in the screen depending on the database contents. I don't know how many images and which ones do I have to insert until I read the database, and in fact this information is time changing. So I can't create this images in design time, I have to do it in runtime.
Do you have any other idea about how could I do this?
Thanks!

Do you know the maximum number of images (icons)?
Edit: Per User/Business from what I can tell in your screenshot

I tried with several Android versions, including 9 and 8. I will try to remove the slashes from the code, thanks for the idea, but I'm not sure this will be the solution, as it works fine in the emulator, but not in the APK...

/verduras.png (β†’ relative path) points to the root directory of the external storage:
/storage/emulated/0/verduras.png (β†’ absolute path)

Check whether the images are saved in this directory on your device.
For assets use no slash or two slashes: //

I don't have the max number, because to show or not an image is a combination of existing entity plus the fact that this entity has or not a specific food.
Both the number of entities and the number of corresponding foods are totally variable. If they weren't, a possible solution would be to create all then at desing time and make them visible / invisible at runtime depending on the database contents, but this is not the case...

No! They aren't! So the problem seems to be that the APK is not creating them there... Any idea of what could I do? I have one: Probably I would have to store them in CloudDB and download and copy them to the folder when the APP starts. Does it sound good to you? Or is there any other way of doing this more easily and avoiding work to me? :wink:

You are not making sense there - you cannot draw an icon image dynamically, so there can only be a specific max number of icons that could be attributed to a customer/business.

Sorry, I didn't understood your question correctly. Yes, I know how many icons do I need, the variable fact is where do I have to insert them into the screen.
Thanks for your support.

How many is that?

I need to deal with 14 different icons.

Did you try to remove the slashes?

Still not, but I will do it now. On the other hand, and following with your ideas, I found the icons at the phone! They are included at the folder appinventor/assets. If I remove the slashes, the APK will find them there?
Thank you very much for your support, I think that I am very near from the solution!
Edit: I just saw that you said "for assets use no slash or two slashes". So my last question is answered. I'm going to try. Thanks agains!

This is the folder for the assets with Companion on devices with Android < 10.

On device with Android β‰₯ 10 the folder is:

/storage/emulated/0/Android/data/<packageName>/files/assets/

Well there we are - not many at all :grin:

I would suggest allowing for two rows of 7, to be sure they fit the screen width of most phones. With 2 Horizontal Arrangements holding 7 Images each and both having auto height, the image positions can be represented by blank pictures (can be just 2 pixels high and match the background) and replaced by required pictures per business as appropriate at run time.

Now, is there a reason to display two businesses at once? That is probably the max you can display on Screen at a time. I suspect you are using the Dynamic Extension to add more and more businesses to a scrolling list? - if you do that, you are going to eventually hit the App memory allocation limit or simply lock or crash the phone - plus it becomes more difficult for the User to find what they want...... or am I wrong? tell me more about how your App works.

I removed the slashes and it worked! Thank you veru much!!!

1 Like