tir38
tir38

Reputation: 10421

On-demand feature module not installed by default

We have a dynamic feature module called replay. We started off making this an install-time module:

    <dist:module
        dist:instant="false"
        dist:title="@string/title_replay">
        <dist:delivery>
            <dist:install-time />
        </dist:delivery>
        <dist:fusing dist:include="true" />
    </dist:module>

when we installed the app locally:

$ ./gradlew app:installDebug --info

We see both base app and dynamic module installed:

Generating APKs for device 'Pixel 3a - 10' for app:debug
The APKs have been extracted in the directory: /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect7963605990779726259
Installing APKs 'base-xxhdpi.apk, base-master_2.apk, base-en.apk, base-arm64_v8a_2.apk, replay-xxhdpi.apk, replay-master.apk' on 'Pixel 3a - 10' for app:debug
[SplitApkInstallerBase]: Created install session 1842207670 with options -r -t -S 12108428
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect7963605990779726259/base-xxhdpi.apk to session 1842207670
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect7963605990779726259/base-master_2.apk to session 1842207670
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect7963605990779726259/base-en.apk to session 1842207670
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect7963605990779726259/base-arm64_v8a_2.apk to session 1842207670
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect7963605990779726259/replay-xxhdpi.apk to session 1842207670
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect7963605990779726259/replay-master.apk to session 1842207670
Installed on 1 device.
Task :app:installDebug in app Finished

However when we change to on-demand:

    <dist:module
        dist:instant="false"
        dist:title="@string/title_replay">
        <dist:delivery>
            <dist:on-demand />  THIS IS THE ONLY CHANGE
        </dist:delivery>
        <dist:fusing dist:include="true" />
    </dist:module>

An install no longer installs dynamic apks:

$ ./gradlew app:installDebug --info

Generating APKs for device 'Pixel 3a - 10' for app:debug
The APKs have been extracted in the directory: /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect788484471691589897
Installing APKs 'base-xxhdpi.apk, base-master_2.apk, base-en.apk, base-arm64_v8a_2.apk' on 'Pixel 3a - 10' for app:debug
[SplitApkInstallerBase]: Created install session 745896174 with options -r -t -S 12031951
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect788484471691589897/base-xxhdpi.apk to session 745896174
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect788484471691589897/base-master_2.apk to session 745896174
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect788484471691589897/base-en.apk to session 745896174
[SplitApkInstaller]: Uploading APK /var/folders/1g/mz8f0hgd0dg8ghy3pd_0llxm0000gn/T/apkSelect788484471691589897/base-arm64_v8a_2.apk to session 745896174
Installed on 1 device.

How are we supposed to do this locally during development? Do we have to use bundletool to generate a universal apk? I assumed Android Plugin was smart enough to do all this for us.

Upvotes: 1

Views: 766

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76669

(Currently) in Android Studio, it only pre-installs the dynamic feature module (as selected in the modules dialog), when selecting "Default APK" instead of "APK from app bundle" for deployment, which might be caused by this issue.

Upvotes: 1

Related Questions