wojciech_maciejewski
wojciech_maciejewski

Reputation: 1319

Android App Bundle base raw resources how to prevent it for pack up into base apk

Maybe the title is a little bit confusing , but I will try to explain

I have an app with a lot of audio files keep in raw resource folder like this

enter image description here

so those audio files are big , and language specific. I'm using app bundle , and its force me to have this base raw folder.

So now every apk generated for specific language has both base and language specific raws, and my apk is twice as big as it should be

enter image description here

Is there a way to prevent adding raw-s from base folder to final apk ?

regards Wojtek

EDIT: I found cheat solution :/ I don't like it but it seems to work.

I have added a resConfig for all suported languages and in base raw folder I've added a dummy empty files 1 KB. Tested on different languages and it works, but it is not the kind of solution I'm feeling fine with :/

Upvotes: 0

Views: 498

Answers (1)

Pierre
Pierre

Reputation: 17437

You can use language targeted assets. It's not documented as not explicitly supported but it should work.

Instead of putting your files at the root of your APK, put them under:

assets/audio#lang_fr/a1.mp3
assets/audio#lang_fr/a2.mp3
...
assets/audio#lang_es/a1.mp3
assets/audio#lang_es/a2.mp3
...
assets/audio/a1.mp3
assets/audio/a2.mp3

Since it's not documented, it's possible that the behaviour changes without notice though, but I thought I'd mention it in case you want to try it out.

Upvotes: 1

Related Questions