google / bundletool

Bundletool is a command-line tool to manipulate Android App Bundles
https://g.co/androidappbundle
Apache License 2.0
3.52k stars 385 forks source link

Unable to install dynamic feature modules with max sdk in manifest #351

Open vielasis opened 11 months ago

vielasis commented 11 months ago

Describe the bug Unable to generate device specific apks which prevents testing DFMs with maxSDK requirements

Bundletool version(s) affected Version: 1.15.5

Stacktrace

[BT:1.15.5] Error: Max SDK version of the App Bundle is lower than SDK version of the device
com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException: Max SDK version of the App Bundle is lower than SDK version of the device
    at com.android.tools.build.bundletool.model.exceptions.UserExceptionBuilder.build(UserExceptionBuilder.java:58)
    at com.android.tools.build.bundletool.commands.BuildApksManager$ApksToGenerate.validate(BuildApksManager.java:535)
    at com.android.tools.build.bundletool.commands.BuildApksManager$ApksToGenerate.<init>(BuildApksManager.java:496)
    at com.android.tools.build.bundletool.commands.BuildApksManager$ApksToGenerate.<init>(BuildApksManager.java:481)
    at com.android.tools.build.bundletool.commands.BuildApksManager.execute(BuildApksManager.java:133)
    at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:922)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:83)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:55)

To Reproduce I have no sample code pushed to my repos but should be straightforward to reproduce Prereq: DFM A with a min SDK of 23, max of 25 DFM B with a min SDK of 26 run bundleDebug

Bundletool cmds: bundletool build-apks --bundle=app-debug.aab --connected-device --output=device.apks ^ Failed with stacktrace above

Expected behavior Should be able build-apks normally since I can do workaround below

Known workaround bundletool build-apks --bundle=app-debug.aab --output=app-debug.apks bundletool install-apks --apks=app-debug.apks On device running Android 14 DFM A - did not install DFM B - works fine On device running Android 7 DFM A - works fine DFM B - did not install

Environment: OS: MacOS Ventura 13.4.1

Additional context None