Reputation: 5241
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
<dist:module
dist:instant="false"
dist:onDemand="false"
dist:title="">
<dist:delivery>
<dist:install-time />
</dist:delivery>
<dist:fusing dist:include="true" />
</dist:module>
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
Upvotes: 1
Views: 2504
Reputation: 5241
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
Upvotes: 2
Reputation: 314
Building Android project that has dynamic feature modules will always work on emulator as there is no delivery system as on Google Play. Also you should use Build -> Build Bundle(s)/APK(s)->Build Bundle(s)
option when you are using feature modules.
In your main module's build.gradle file you need to set dynamicFeatures, e.g.:
android {
...
dynamicFeatures = [
':module1',
':module2',
':module3'
]
...
}
While in dynamic feature module's build.gradle file you need dependency for main module:
dependencies {
implementation project(':app')
}
Upvotes: 0