andrew COSTIGAN
andrew COSTIGAN

Reputation: 31

Is there an alternative way to remove unused images from Codename One project?

I hope you are well. I am nearing the end of my project and want to reduce the size of my project folder. Over the course of development of app I have added numerous images to the project folder both multi image and one-off images. I am hoping to remove all unused images. I have just used the Delete Unused images in the Designer and now trying to run code I get the following Warning: loading large images using EncodedImage.create(InputStream) might lead to memory issues, try using EncodedImage.create(InputStream, int) which fails to run in the end. If I remove them manually/directly from this image folder the complier throws "null pointer directory does not exist" error. Can you please advise as there is a lot of images unused but still remain which are contributing to the large folder size.

Upvotes: 1

Views: 214

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

No. You would need to review the suggested images in the "Remove Unused Images" list and manually unmark everything used in the code using CTRL-Click.

This is still useful as it doesn't list all the images used by the theme, you only need to unmark stuff you use in the code which you should generally know.

The reason for this is simple. The original feature was developed for the old GUI builder which was based in the designer tool. As such the references to images from the GUI builder were easily located. However, searching the code for image use is a problem as it might detect things such as commented out blocks or even old versions of the code in backup files. So we literally don't know which images are used in your code and never knew that.

Upvotes: 1

Related Questions