I have added a dynamic feature module to my project and everything works fine when trying on emulator or direct run on a device (using the run button) but when I try to generate a APK using command line (:app:assembleRelease
) the dynamic feature modules wont be included in the final APK and it's missing. I know I can create a Android App Bundle and then create a APK from .aab
with all the modules. but the question is:
is there a way to create full apk (all modules such as: Dynamic features included) directly form source?
I think you can't create full apk directly form source.
You should take 3 steps:
Build app bundle:
./gradlew clean bundleRelease
Generate one apk by bundletool with switch --mode=universal
java -jar bundletool-all-0.10.2.jar build-apks --bundle=app.aab --output=release.apks --ks=release.keystore --ks-pass=pass:xxxxxx --ks-key-alias=xxxxxxkey --key-pass=pass:xxxxxx --mode=universal
Unzip generated file:
unzip release.apks
With the command line, you should use :app:bundleRelease
which will build an Android App Bundle (.San), then use bundletool
to generate the APKs and deploy them to the device.
The full documentation can be found here: https://developer.android.com/studio/command-line/bundletool
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With