How to use @UsesAssets?

Do you have an idea as to how I can do this with @UsesAssets? Because I've tried and got nothing and no errors.


That's not particularly useful. Show some code and we can help you. The code I showed just opens the asset as an input stream. You still have to read the content.

No I was asking how I would bundle assets with my extension, it broke my project yesterday because of what I tried which was...

@UsesAssets(fileNames = "file.ttf") and @UsesAssets(fileNames = "assets/file.ttf")

But neither seemed to work.

see the annotation documentation

see also the example from the App Inventor sources as example how to use it

@UsesAssets(fileNames = "location.png, marker.svg")


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

Those do not help me. Where do I place these assets?

I never used it up to know, but I think you put the assets into the subdirectory /assets of your extension

Assuming your extension is, create a folder called assets at the same level in the directory hierarchy and place your assets in it. Next, add the @UsesAssets annotation with the filenames (sans assets/). Lastly, use the Form's openAssetForExtension method to open the asset for reading. You can see an example of how we do this in the Look extension: