如何生成包含动态功能模块的完整APK文件 [英] How to generate full APK file including dynamic feature module

查看:119
本文介绍了如何生成包含动态功能模块的完整APK文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目具有动态功能模块,我想生成调试或发布包含动态功能的APK.目前,我只能获取基本的APK文件.

My project has dynamic feature module and I would like to generate debug or release APK including the dynamic feature. Currently I can get only base APK file.

基本上,我会像正常应用程序一样生成APK文件.但是我无法使用动态功能.是的,我知道动态功能将基于AAB起作用.

Basically I would generate an APK file like normal application. But I couldn't do with dynamic feature. Yes, I know dynamic feature will work based on AAB.

有什么方法可以制作普通(基本+所有模块)APK文件?请对此提供帮助.

Is there any ways to make a normal(base + all modules) APK file?. Please help on this.

谢谢

推荐答案

您可以指定是否需要将按需模块包含在通常为较旧设备生成的通用APK中,然后可以使用 bundletool可以从App Bundle中生成通用APK:.

You can specify if your on demand module needs to be included in the universal APK that is usually generated for older devices, and then you can use bundletool to generate an Universal APK from the App Bundle:.

在这种情况下,您可以使用类似以下内容的

In this particular case, you can use something like:

bundletool build-apks --bundle <bundle_file> --output <APKS file> --ks <key_store> --key-pass <jks password> --ks-key-alias <key_alias> --ks-pass <key password> --overwrite --mode=universal

关键是要包括--mode=universal这个指示bundletool的工具,以生成一个通用APK,其中将包含清单中所有具有<dist:fusing dist:include="true"/>的模块.

The key point is to include the --mode=universal this instruct bundletool to generate an Universal APK that will include all modules that have <dist:fusing dist:include="true"/> in the manifest.

以类似的方式,当您在设备上通过Android Studio运行项目时,使用运行"的默认配置(部署=默认APK),它将包括您所有的按需模块.
相反,当您使用运行"配置(从AppBundle部署= APK)从Studio运行应用程序时,可以选择要安装的模块.

In a similar way, when you run your project from Android Studio on a device, using the default configuration for Run (Deploy = Default APK) it includes all of your on demand modules.
Instead, when you run the application from Studio using the Run configuration (Deploy = APK from AppBundle) you can pick and choose which modules are installed.

但是,在两种情况下,如果您不通过Play商店,就无法测试按需下载的模块.

However, in both cases, you cannot test on demand module downloads if you don't go through the Play store.

Google在I/O上引入了 内部应用共享 允许轻松测试您的App Bundle和APK,包括调试版本:

Google introduced at I/O Internal App Sharing that allows to allow testing easily your App Bundles and APKs, including debug builds:

通过内部应用共享,您可以通过在 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆