Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic feature. Error: failed processing manifest

I have a base module and I'd wanted to create feature one which contains some libs. One of this libs was into the base module and when I moved it to the feature and removed it from base one I got an error:

APT: error: resource style/SDKTheme.Translucent (aka io.app.dev.debug:style/SDKTheme.Translucent) not found.

It works if base and feature modules have this dependency, but in this case I lost a profit of separating.

I found a known issue:

In a dynamic feature module’s manifest, you should not reference resources that don’t exist in the base module. That’s because, when Google Play generates your app’s base APK, it merges manifests for all modules into that of the base APK. So, resource linking breaks if the base APK’s manifest references resources that don’t exist in the base APK.

is this my problem?

like image 319
Gorets Avatar asked Aug 31 '18 08:08

Gorets


1 Answers

Yes, that exactly is your problem.

Solutions are:

  1. Have the actual implementation of your style in your feature module, but create an empty declaration of the style in your base module. Example of how the empty declaration will look is:

<style name="SDKTheme.Translucent" />

What happens is that the manifest merger picks up this style during merging, even though the actual implementation of the style is being introduced through the feature module’s styles.

  1. Keep style declarations in the base module. Although, this only works if all resources referenced are in the base module as well.

For more information, read this blog post by Ben Weiss - https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e

like image 81
Chizoba Ogbonna Avatar answered Oct 19 '22 20:10

Chizoba Ogbonna