Closed DeweyReed closed 4 years ago
It turns out that the library module doesn't include Theme
dependency, and then it doesn't know how to inflate <Button>
to a MaterialButton
.
Solution 1: Include Theme
in every module or use api
in the base module.
Solution 2: Define AppTheme.LibraryPreview
and use it in library modules, use AppTheme
in the app
module, and add tools:replace="android:theme"
to the manifest.
<style name="AppTheme.LibraryPreview">
<item name="viewInflaterClass">
com.google.android.material.theme.MaterialComponentsViewInflater
</item>
</style>
Even if I've disabled Theme in the edit mode, Theme still breaks MaterialButton in library modules. In the application mode, everything works fine. What's going on?