Code Monkey home page Code Monkey logo

Comments (10)

garretyoder avatar garretyoder commented on May 22, 2024

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.

https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md

from colorful.

tcqq avatar tcqq commented on May 22, 2024

But I am using this version now: com.android.support:design:28.0.0-alpha1, because "28.0.0-alpha1" version contains "material-components"

from colorful.

garretyoder avatar garretyoder commented on May 22, 2024

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.

from colorful.

tcqq avatar tcqq commented on May 22, 2024

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

image

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

image

from colorful.

tcqq avatar tcqq commented on May 22, 2024

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)

from colorful.

tcqq avatar tcqq commented on May 22, 2024

@garretyoder com.android.support and com.google.android.material cannot add at the same time.
image
I created a new project and tried to add it at the same time, occurred an error.
image

from colorful.

tcqq avatar tcqq commented on May 22, 2024

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
image
image

  • If I change Theme.MaterialComponents.Light.DarkActionBar to Theme.AppCompat.Light.DarkActionBar, the error will not appear.
  • Or if I click on refactoring to AndroidX after, Now I use Theme.MaterialComponents.Light.DarkActionBar, the error log will also not appear.
    image

So fixing the following error I found two solutions:

  1. Support library use 28.0.0-alpha1 version , and use BaseTheme.THEME_APPCOMPAT instead of BaseTheme.THEME_MATERIAL or BaseTheme.THEME_MATERIAL_COMPONETS
  2. Refactoring to AndroidX, and use BaseTheme.THEME_APPCOMPAT or BaseTheme.THEME_MATERIAL or BaseTheme.THEME_MATERIAL_COMPONETS

Error log

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)

from colorful.

garretyoder avatar garretyoder commented on May 22, 2024

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.

from colorful.

garretyoder avatar garretyoder commented on May 22, 2024

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.

from colorful.

tcqq avatar tcqq commented on May 22, 2024

Ok.

from colorful.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.