I generated an apk for an android app and it appears that all assets folders that have a rename
tag in my project.xml file are duplicated in the apk file.
For example, if in my project folder I have an Assets/fonts folder, If I have, in my project.xml file:
<assets path="Assets/fonts" rename="fonts"> ... </assets>
Then, in the generated apk, I will have an assets folder containing a fonts folder (with my fonts) but also containing another assets folder with another fonts folder (containing another copy of my fonts).
So, in the apk, I have:
assets/fonts
and
assets/assets/fonts
Is this a normal behaviour? That doesn’t seems to be optimal as it unecessary duplicate assets (and increase apk size)
One way this can happen is with multiple <asset />
tags:
<assets path="Assets" />
<assets path="Assets/fonts" rename="fonts" />
Another possibility is you have leftover files from an old build. Try deleting Export/android/release/bin/app/src/main/assets/assets/fonts
and checking whether it comes back.
Yes I have:
<assets path="Assets" rename="assets" />
<assets path="Assets/fonts" rename="fonts" />
<assets path="Assets/sounds" rename="sounds">
So how am I supposed to rename an assets subfolder when I have more than one subfolder in my assets folder?
In Assets I have multiple folders (like lang
, img
, fonts
, sounds
, videos
…) and I want to rename fonts
and sounds
. How am I supposed to do this so that my asset folder don’t get duplicated in the final apk?
Maybe you could try…?
<assets path="Assets" exclude="fonts|sounds" rename="assets" />
<assets path="Assets/fonts" rename="fonts" />
<assets path="Assets/sounds" rename="sounds" />
You could also do it by extension
<assets path="Assets" include="*.jpg|*.png" rename="assets" />
<assets path="Assets/fonts" rename="fonts" />
<assets path="Assets/sounds" rename="sounds" />
Or you may decide to just use “assets/sounds” rather than using a rename, or alternatively not doing a general “Assets” tag, and including other folders
<assets path="Assets/fonts" rename="fonts" />
<assets path="Assets/sounds" rename="sounds" />
<assets path="Assets/images" rename="images" />
I end up doing something like this:
<assets path="Assets/fonts" rename="fonts" />
<assets path="Assets/sounds" rename="sounds" />
<assets path="Assets/images" rename="assets/images" />
<assets path="Assets/data" rename="assets/data" />
...
and so on for each of my assets subfolders…