Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including the library in a dynamic feature module changes typography themes elements #20

Closed
fbarthelery opened this issue Sep 17, 2020 · 5 comments

Comments

@fbarthelery
Copy link

I got a weird issue when I tried to include the library in a dynamic feature module. I don't know what is happening exactly but this seems to modify some theme attributes used in the regular view system.

Here is a link to a minimal sample reproduction
https://github.com/fbarthelery/Bug-material-components-android-compose-theme-adapter

Without compose-theme-adapter dependency

With compose-theme-adapter dependency

@chrisbanes
Copy link
Contributor

First of all, this isn't a library issue. You're not invoking any MDC Adapter code (or even Compose code for that matter) so there's no way it can alter the theme. This library also doesn't modify the theme in any way.

This looks to me like a Gradle transitive dependency issue. This library depends on MDC 1.1.0, to not force consumers to upgrade if they don't want/need to. I'd try forcing the MDC version you want using by overriding the transitive dependency version:

implementation 'com.google.android.material:material:1.2.1!!'

This should happen automatically, since:

Gradle resolves any dependency version conflicts by selecting the latest version found in the dependency graph

But maybe being a feature module is how messing with it some how.

@chrisbanes
Copy link
Contributor

chrisbanes commented Sep 17, 2020

Looked more into this. It's not a transitive dependency issue, the MDC dependency gets correctly upgraded to: com.google.android.material:material:1.1.0 -> 1.2.1 (*).

This looks to me like a feature module issue. If I add implementation 'com.google.android.material:compose-theme-adapter:1.0.0-alpha02' to the app module (as well as the feature module), it all works correctly. I'm guessing that the resource IDs are somehow not correctly resolved when the dependency is only the feature module. Not much we can do in the library though.

@chrisbanes
Copy link
Contributor

Adding @keyboardsurfer @wojtek-kalicinski

@keyboardsurfer
Copy link

I can reproduce the issue. For now, replacing ?textAppearanceHeadline3 with @style/TextAppearance.MaterialComponents.Headline3 is a feasible workaround.
We'll have to look into this more in depth to get it fully resolved though.

@fbarthelery
Copy link
Author

I agree this is not a library issue but I had no clue where to start.

I'm happy to fill an issue in the correct component so this can be followed up properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants