Closed tcqq closed 6 years ago
If you're inheriting your base style from Theme.MaterialComponets to use the new MaterialComponets theme, you need to add the new design library as a dependency to your project.
But I am using this version now: com.android.support:design:28.0.0-alpha1
, because "28.0.0-alpha1" version contains "material-components"
The material componets theme is still very much alpha as far as Google is concerned, hence the -alpha denotation. I recommend matching the version you're using to the version Colorful is using.
implementation 'com.google.android.material:material:1.0.0-alpha1'
the sdk28 version is depending on P. I don't plan on moving Colorful's SDK to android P until P's apis are marked stable in DP3.
Hi, I tested it, when I change the support library version from 28.0.0-alpha1 to 27.1.1 and add the com.google.android.material:material:1.0.0-alpha1
library, I get an error
The error is fixed when I change the support library version from 27.1.1 to 28-alpha1 and delete the com.google.android.material:material:1.0.0-alpha1
library
When I remove exclude group: 'com.google.android.material', module: 'material'
, the above error will appear again.
api (com.github.garretyoder:Colorful:2.3.2) {
exclude group: 'com.google.android.material', module: 'material'
}
If do not delete, the above error will not appear, but the log will have the following error.
AppCompatDelegate: Failed to instantiate custom view inflater android.support.design.theme.MaterialComponentsViewInflater . Falling back to default.
java.lang.ClassNotFoundException: Invalid name: android.support.design.theme.MaterialComponentsViewInflater
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1014)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1092)
@garretyoder com.android.support
and com.google.android.material
cannot add at the same time.
I created a new project and tried to add it at the same time, occurred an error.
If I remove material
library, and change support library version to 28.0.0-alpha1
, now can run, but the log shows the following error
Theme.MaterialComponents.Light.DarkActionBar
to Theme.AppCompat.Light.DarkActionBar
, the error will not appear.Theme.MaterialComponents.Light.DarkActionBar
, the error log will also not appear.
28.0.0-alpha1
version , and use BaseTheme.THEME_APPCOMPAT
instead of BaseTheme.THEME_MATERIAL
or BaseTheme.THEME_MATERIAL_COMPONETS
BaseTheme.THEME_APPCOMPAT
or BaseTheme.THEME_MATERIAL
or BaseTheme.THEME_MATERIAL_COMPONETS
AppCompatDelegate: Failed to instantiate custom view inflater android.support.design.theme.MaterialComponentsViewInflater . Falling back to default.
java.lang.ClassNotFoundException: Invalid name: android.support.design.theme.MaterialComponentsViewInflater
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1014)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1092)
Refactoring to AndroidX will fix the issue. I might make another release later today to try to enable some build magic to support the material components theme without relying on the new design library until it's marked stable.
I have rolled back support for the material componets theme in the stable branch as it's bound to androidx and android P, and will cause build errors when not targeting android P. If you wish to use the material componets theme, I've moved it into a new branch called 'android-p' where you can build it.
Ok.
@garretyoder If use
THEME_MATERIAL
orTHEME_MATERIAL_COMPONETS
, the following error will appear. What did i do wrong?Code
ColorfulKt.Colorful().apply(this, true, BaseTheme.THEME_MATERIAL_COMPONETS);
Log