android / codelab-android-dynamic-features

Apache License 2.0
123 stars 47 forks source link

APK from app bundle does not contain the dynamic module requested #3

Closed wisechengyi closed 5 years ago

wisechengyi commented 5 years ago

Chatted with Ibrahim, and was asked to file an issue.

Repro: https://github.com/wisechengyi/android-dynamic-features/tree/yicdn

screen shot 2019-02-07 at 2 57 40 pm

Click 'show assets' once app launches, and it will show 'error loading assets', whereas it should a textbox titled 'Asset Content'. When stepping through https://github.com/wisechengyi/android-dynamic-features/blob/yicdn/app/src/main/java/com/google/android/samples/dynamicfeatures/MainActivity.kt#L56, manager.installedModules is empty.

If switching from 'APK from app bundle' to 'Default APK', it works.

wisechengyi commented 5 years ago

FWIW, dynamic delivery works by deploying the aab to play console, so likely a local toolchain issue.

pfmaggi commented 5 years ago

I've filed a bug internally and I'm waiting for a reply to update this issue.
To test locally from the App Bundle, you can use bundletool.

In particular, once you've generated the App Bundle, you can use the following commands to install the right minimum set for your app:

bundletool build-apks --bundle app.aab --output app.apks
features/app/build/outputs/bundle/debug$ bundletool install-apks --apks app.apks

Keep in mind that this is not going to be able to download the additional modules. To test the download, at this moment, you've to go through Play.

Or you can install the complete application (universal APK) using the commands:

bundletool build-apks --mode=universal --bundle app.aab --output app.apks
features/app/build/outputs/bundle/debug$ bundletool install-apks --apks app.apks

More information on how to use Bundletool can be find on the documentation site.

pfmaggi commented 5 years ago

I was supposing that this was now fixed in the newer AS, but seems that it's still a problem.

Closing this and follow up on the public issue.

ziSo12 commented 3 years ago

Encountering a similar error. When using the above build configuration (APK from app bundle), my build fails with the error message: The APK Set archive does not contain the following modules: [list of my dynamic feature modules]

I'm also getting a warning: The option setting 'android.injected.modules.install.list=list of my dynamic feature modules' is experimental.

All I could find is that this error message is from the bundletool source code, which means that AS is using bundletool during the build process. Do I need some special option and use bundletool manually in order to fix this?

I'm getting an "acces denied" message when trying to view your "public issue" link.