[英]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我有一个应用程序,其中有很多音频文件保存在这样的
raw
资源文件夹中
so those audio files are big , and language specific.所以这些音频文件很大,而且是特定于语言的。 I'm using app bundle , and its force me to have this base
raw
folder.我正在使用 app bundle ,它迫使我拥有这个基本的
raw
文件夹。
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所以现在每个为特定语言生成的 apk 都有基础和特定语言的原始数据,我的 apk 是应该的两倍
Is there a way to prevent adding raw-s from base folder to final apk ?有没有办法防止将 raw-s 从基本文件夹添加到最终 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.我为所有支持的语言添加了
resConfig
,并在基本原始文件夹中添加了一个 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:不要将文件放在 APK 的根目录下,而是将它们放在:
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.由于它没有记录在案,因此行为可能会在没有通知的情况下发生变化,但我想我会提到它,以防您想尝试一下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.