简体   繁体   English

Android App Bundle基础原始资源如何防止它打包成基础apk

[英]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.

相关问题 如何为 python 基础 Android 应用程序生成 APK - How to generate APK for python base Android app Android-将资源打包到APK中 - Android - Pack resources into apk Android 应用程序包文件名创建后缀为“apks/splits/base-arm64_v8a_2.apk”的原因是什么? - What is the reason why Android app bundle filename is created with number postfix like 'apks/splits/base-arm64_v8a_2.apk'? 如何解决/data/app/com.android.chrome-1/base.apk上的ANR问题? - How to fix ANR issue on /data/app/com.android.chrome-1/base.apk? 运行Android应用(APK)时如何从内存中获取基址? - How do I get base address from memory when an Android app (APK) is run? 在Android上更新原始资源而不更新APK - Updating Raw Resources Without Updating APK on Android 如何单独构建SQLite数据库并捆绑到maven build中的android应用程序 - How to build the SQLite Data base separately and bundle to the android app in maven build 不可翻译资源只能在基本值/文件夹中定义-Android导出APK - Non-translatable resources should only be defined in the base values/ folder - Android Export APK 如何从 Android 自动备份中排除 base.apk? - How to exclude the base.apk from Android Auto Backup? 在Android应用程序中本地化原始资源 - localizing raw resources in android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM