Search code examples
androidapkdynamic-feature-module

Class Not Found when build APK when using dynamic feature


I have menu module setup by 'com.android.dynamic-feature'. Everything working fine when I coding and run by android studio. When package apk by Build -> Build APK(s) it crash Class Not Found when I start activity in module. Notes: the activity path is correct, I guess my module doesn't attach into app

  1. Manifest module:
    <dist:module
        dist:instant="false"
        dist:onDemand="false"
        dist:title="">
        <dist:delivery>
            <dist:install-time />
        </dist:delivery>
        <dist:fusing dist:include="true" />
    </dist:module>
  1. module gradle
apply plugin: 'com.android.dynamic-feature'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: '../shared_dependencies.gradle'

Is there any mistake here? Thanks


Solution

  • If you use <dist:fusing dist:include="true" /> and sign your app by APK it still not include into your APK. dynamic-feature only use with AAB format.

    If you still want to use APK format you have to use bundle-tool to generate universal APK from AAB

    https://developer.android.com/studio/command-line/bundletool