'Accessing assets stored in AAR from application
I have a library project which includes some TFLite models. I want to be able to distribute the library and include the models in the AAR's assets folder. I've put everything in the assets folder and when inspecting the resulting AAR, I see that the models exists.
My question is, how can I access these models? either from the library itself (preferably) or from the application that uses it?
If I look try and access the assets the normal way for an application
AssetManager am = context.getAssets();
am.list(assetFolder)
I get an empty list.
I saw many posts about including assets in an android AAR library but none that referred to how to actually use these assets, so am I missing something very basic here?
EDIT
This is how the AAR is structured

Inside the assets folder I have a resources folder which contains the models
so
- AAR
-- assets
--- resources
---- model
I tried different values for assetFolder in the code, /, resources, all gave empty lists
Solution 1:[1]
Try with:
am.list("resources/model")
Just tested with aar and it works. Be careful, list returns directories and files in the specified path, it doesn't show files in subfolders
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Giuseppe Giacoppo |
