collapsingtoolbarlayout-subtitle
collapsingtoolbarlayout-subtitle copied to clipboard
Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
implementation "com.google.android.material:material:1.5.0"
implementation "com.hendraanggrian.material:collapsingtoolbarlayout-subtitle:1.3.0-SNAPSHOT"
java.lang.RuntimeException: Unable to start activity ComponentInfo{care.viva.app/care.viva.app.profissional.views.ReciboActivity}: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:169)
at android.app.ActivityThread.main(ActivityThread.java:6521)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class com.google.android.material.appbar.SubtitleCollapsingToolbarLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at care.viva.app.databinding.ActivityReciboBinding.inflate(ActivityReciboBinding.java:184)
at care.viva.app.databinding.ActivityReciboBinding.inflate(ActivityReciboBinding.java:178)
at care.viva.app.profissional.views.ReciboActivity.onCreate(ReciboActivity.kt:39)
at android.app.Activity.performCreate(Activity.java:7051)
at android.app.Activity.performCreate(Activity.java:7042)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:169)
at android.app.ActivityThread.main(ActivityThread.java:6521)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalAccessError: Field 'com.google.android.material.resources.TextAppearance.textColor' is inaccessible to class 'com.google.android.material.internal.SubtitleCollapsingTextHelper' (declaration of 'com.google.android.material.internal.SubtitleCollapsingTextHelper' appears in /data/app/care.viva.app-LvNQ-soKPeFPmhHXCBr0Fw==/base.apk!classes18.dex)
at com.google.android.material.internal.SubtitleCollapsingTextHelper.setExpandedTitleTextAppearance(SubtitleCollapsingTextHelper.java:356)
at com.google.android.material.appbar.SubtitleCollapsingToolbarLayout.<init>(SubtitleCollapsingToolbarLayout.java:132)
2022-02-22 10:38:21.594 10181-10181/care.viva.app E/AndroidRuntime: at com.google.android.material.appbar.SubtitleCollapsingToolbarLayout.<init>(SubtitleCollapsingToolbarLayout.java:84)
It's because the material library v1.5.0 changed its API. I created a PR https://github.com/hendraanggrian/collapsingtoolbarlayout-subtitle/pull/41 to fix it.
@hendraanggrian could you have a look?
@baole Thanks for the PR. Run into the same issue. How are you working around it at the moment? Thanks!
@hendraanggrian could you have a look at @baole's PR please 🙏
@hendraanggrian could you have a look at @baole's PR please 🙏
I will tonight. I'm sorry I wasn't here more often, I truly am.
Thanks a lot @hendraanggrian 🔥
It's taking longer than what was expected because I intend to release every major material versions.
I have published non-snapshot version 1.1.0, now I'm working on 1.2.0.
@hendraanggrian thanks for the library. I think it's best to work backwards from the latest version. We had to move away from your library because another library required the latest material version and I think that's what most developers are on at this time.
I'm sorry to disappoint, but growing the version incrementally allows me to implement features it is supposed to inherit.
Like for instance with version 1.2.0, multilining title and subtitle now works.
Version 1.5.0-SNAPSHOT has been released. I will also publish the release version soon. I'll be glad if you guys can try it first and see what am I missing in this version.
@hendraanggrian Thanks!
@hendraanggrian keep me posted when you release the 1.5.0, gradle doesn't seems to find the snapshot on my side :/
Version 1.5.0 has been released with everything working but Material You styling. By the time I realized it was missing, the package has already been published.
If you use Theme.Material3 in your app, it will still appear as if it was still in Theme.MaterialComponents.
I intend to fix it with version 1.6.0.
Thanks!
I'm seeing a similar inflate crash in 1.5.0 around setExpandedTextAppearance() in CollapsingTextHelper2. It looks like the getTextColor() method has been removed from TextAppearance causing the crash. Will this be fixed in 1.6.0 as well?
Caused by: java.lang.NoSuchMethodError: No virtual method getTextColor()Landroid/content/res/ColorStateList; in class Lcom/google/android/material/resources/TextAppearance; or its super classes (declaration of 'com.google.android.material.resources.TextAppearance' appears in /data/app/~~R0w0z5GCXtBOIKWfIo5KRA==/com.ibotta.android-ULjP3LkscCrAWd9CzwZe-g==/base.apk!classes8.dex)
at com.google.android.material.internal.CollapsingTextHelper2.setExpandedTextAppearance(CollapsingTextHelper2.java:525)
at com.google.android.material.appbar.SubtitleCollapsingToolbarLayout.<init>(SubtitleCollapsingToolbarLayout.java:170)
@IDMCI I find this rather odd since TextAppearance#getTextColor() is present in material 1.5.0 and 1.6.0. It is called in CollapsingTextHelper, and therefore CollapsingTextHelper2 too. Can you state material version you are on?
The snapshot of version 1.6.0 is available to try. Though I suspect you're going to run into the same issue.
@hendraanggrian That was it! Thank you soooo much! I thought it was strange that method just disappeared, lol. Turns out we had held back on updating material because of another issue that's since been resolved. So now everything works!
Thanks everyone for participating.