简体   繁体   中英

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

在此处输入图片说明

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

在此处输入图片说明

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 :/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM