AndroidX icon indicating copy to clipboard operation
AndroidX copied to clipboard

MaterialCardView InflateException

Open jenokizm opened this issue 5 years ago • 5 comments

im using latest vs2019 + xamarin android 10.2 I successfully updated to AndroidX. when i use androidx.cardview.widget.CardView everything works, but when replaced to com.google.android.material.card.MaterialCardView I get an error

Android.Views.InflateException: 'Binary XML file line #1: Binary XML file line #1: Error inflating class com.google.android.material.card.MaterialCardView'

in

View itemView = LayoutInflater.From(parent.Context).
                       Inflate(Resource.Layout.cv_item_template, parent, false);

jenokizm avatar Mar 25 '20 07:03 jenokizm

@jenokizm THanks for the report.

According to

https://developer.android.com/reference/com/google/android/material/card/MaterialCardView

com.google.android.material.card.MaterialCardView derives from androidx.cardview.widget.CardView.

Did you add Material nuget?

https://www.nuget.org/packages/Xamarin.Google.Android.Material/

Otherwise, please submit link to repo (or zip archive) for minimal repro sample. Thanks

moljac avatar Mar 26 '20 16:03 moljac

thanks, yes Xamarin.Google.Android.Material 1.1.0-rc3 I can’t provide an example because I have a big project and a slowed down laptop, I don’t have time to put together a minimal example. I will do it from the main computer not earlier than in a month, if you have time try just binding with RecyclerView.Adapter this should result in an error in the line LayoutInflater

jenokizm avatar Mar 26 '20 17:03 jenokizm

Can you at least provide MainActivity and layout file, or write down steps from creating project (short steps like create app, add layout, change code...)

moljac avatar Mar 27 '20 12:03 moljac

AppMaterialCardViewTest.zip hi, this demo app. to reproduce the error replace androidx.cardview.widget.CardView to com.google.android.material.card.MaterialCardView (in cv_lesson2.xml) and click the fab button.

jenokizm avatar May 05 '20 08:05 jenokizm

@jenokizm Thanks for the sample. I will look at it ASAP.

moljac avatar May 05 '20 09:05 moljac

Closing as this is likely stale. If this is still an issue, please create a new issue.

jpobst avatar Mar 14 '24 20:03 jpobst