Error inflating class com google android material card materialcardview

ClassNotFoundException: «com.google.android.material.card.MaterialCardView» #125

Comments

matheuskiser commented May 27, 2018

Overview

Trying to use com.google.android.material.card.MaterialCardView on my project. I’ve set my design/support dependencies to 28.0.0-alpha1 and set compileSdkVersion ‘android-P’. I’m also setting Theme.MaterialComponents.Light.NoActionBar as my parent app theme. I get ClassNotFoundExceptions when I try to use any of the material widgets, including MaterialCardView.

Here is the stack trace:
05-27 00:41:55.189 8022-8022/com.miser.billmoney E/AndroidRuntime: FATAL EXCEPTION: main Process: com.miser.billmoney, PID: 8022 android.view.InflateException: Binary XML file line #159: Binary XML file line #159: Error inflating class com.google.android.material.card.MaterialCardView Caused by: android.view.InflateException: Binary XML file line #159: Error inflating class com.google.android.material.card.MaterialCardView Caused by: java.lang.ClassNotFoundException: Didn’t find class «com.google.android.material.card.MaterialCardView» on path: DexPathList[[zip file «/system/framework/org.apache.http.legacy.boot.jar», zip file «/data/app/com.miser.billmoney-82jv4GAw3oNM4puzAMQEgg==/base.apk»],nativeLibraryDirectories=[/data/app/com.miser.billmoney-82jv4GAw3oNM4puzAMQEgg==/lib/x86, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.view.LayoutInflater.createView(LayoutInflater.java:606) 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.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 com.miser.billmoney.fragments.HomeFragment.onCreateView(HomeFragment.kt:70) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2335) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1423) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1754) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1822) at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3239) at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3195) at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:195) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:596) at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1382) at android.app.Activity.performStart(Activity.java:7151) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2949) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:194) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:180) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:157) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:72) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1800) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6649) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

Version number

Operating system and device

Android P — Pixel 2xl

The text was updated successfully, but these errors were encountered:

Читайте также:  Сканер прослушивающих устройств для андроид

Источник

MaterialCardView InflateException #80

Comments

jenokizm commented Mar 25, 2020 •

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’

The text was updated successfully, but these errors were encountered:

moljac commented Mar 26, 2020

@jenokizm
THanks for the report.

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

Did you add Material nuget?

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

jenokizm commented Mar 26, 2020

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

moljac commented Mar 27, 2020

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. )

jenokizm commented May 5, 2020

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.

moljac commented May 5, 2020

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

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

MaterialCardView InflateException #80

Comments

jenokizm commented Mar 25, 2020 •

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’

The text was updated successfully, but these errors were encountered:

Читайте также:  Жизнь с рабыней познание чувств андроид последняя версия

moljac commented Mar 26, 2020

@jenokizm
THanks for the report.

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

Did you add Material nuget?

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

jenokizm commented Mar 26, 2020

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

moljac commented Mar 27, 2020

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. )

jenokizm commented May 5, 2020

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.

moljac commented May 5, 2020

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

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Русские Блоги

MaterialCardView Материальных Компонентов

Material Card

Карта — это элемент управления, который может содержать фотографии, текст и ссылки на одну тему. Они могут отображать контент с элементами разных размеров, например, фотографии с субтитрами переменной длины.

MaterialCardView — это настраиваемый компонент, основанный на CardView в библиотеке поддержки Android. MaterialCardView предоставляет все функции CardView, но добавляет некоторые пользовательские атрибуты, которые более удобны и практичны в использовании.

Примечание. MaterialCardView — это постоянная реализация Google, которая продолжит разработку новых функций и обновлений. Большинство из этих обновлений будут основаны на стиле и будут иметь дополнительные параметры для размещения содержимого (например, разделители, изображения, действия и обработка текста). Обновление также будет включать в себя функцию поведения карты в колоде.

Применение

Чтобы использовать MaterialCardView, вам необходимо представить библиотеку элементов управления:

Читайте также:  Airpods pro тихий звук андроид

Таким образом, вы можете использовать больше, чем просто MaterialCardView и другие элементы управления материалом.

Перед его использованием вам необходимо изменить свой AppTheme на Theme.MaterialComponents или его подклассы, в противном случае вы получите ошибку:

Если ваш файл манифеста (AndroidManifest.xml) находится в приложении android:theme=»@style/AppTheme» Затем измените его в style.xml:

После выполнения предыдущих операций, вы можете добавить MaterialCardView в файл макета

непроверенный

выбранное состояние

собственности

Атрибуты XML

характерная черта Связанные атрибуты
Border app:strokeColor app:strokeWidth
Checkable android:checkable
Checked Icon app:checkedIcon app:checkedIconTint
Foreground Color app:cardForegroundColor
Ripple Color app:rippleColor

Конечно, вы также можете использовать некоторые методы в коде Java / Kotlin:

Источник

Ошибка при запуске приложения на AndroidStudio?

Добрый день! При запуске приложения вылетает такая вот ошибка:

Caused by: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.google.android.material.navigation.NavigationView
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.material.navigation.NavigationView
Caused by: java.lang.reflect.InvocationTargetException

и приложение закрывается. Подскажите как исправить.

  • Вопрос задан более года назад
  • 236 просмотров

Простой 1 комментарий

Из описания следует, что нужно исправить ошибку в XML разметке в строке 8.

Я только начинаю, может подскажите подробнее? Чего не хватает?

dependencies <
implementation ‘com.mxn.soul:flowingdrawer-core:2.1.0’
implementation ‘com.nineoldandroids:library:2.4.0’
implementation fileTree(dir: «libs», include: [«*.jar»])
implementation ‘androidx.appcompat:appcompat:1.1.0’
implementation ‘androidx.constraintlayout:constraintlayout:1.1.3’
implementation ‘androidx.coordinatorlayout:coordinatorlayout:1.1.0’
implementation ‘com.google.android.material:material:1.1.0’
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘androidx.test.ext:junit:1.1.1’
androidTestImplementation ‘androidx.test.espresso:espresso-core:3.2.0’

Как искать ответ самому.
Видим ругается на Error inflating class com.google.android.material.navigation.NavigationView
гуглим com.google.android.material.navigation.navigationview implementation
нагугливается, что это com.shreyaspatil

Удивляемся. Пока гуглили заметили, что в пустом проекте можно попробывать сделать через визард активностей.

Пробуем. И видим.

implementation ‘androidx.navigation:navigation-fragment:2.3.0’
implementation ‘androidx.navigation:navigation-ui:2.3.0’

ок. открываем лайоут .
становимся на com.google.android.material.navigation.NavigationView
нажимаем аккорд Ctrl+B — мой любимый — перейти туда где это было определено.

попадаем в класс
мотаем вверх смотрим
package com.google.android.material.navigation;

подымем взгляд еще выше на заголовок окна и видим
com.google.android.material:material:1.1.0@aar

Мое первое предположение оказалось ложным.

Возвращаемся на лайоут.
Редим предпросмотра. Серыми квадратами рисуется, то что не смогла система правильно распознать.
Забыли подключить или написали неправильно.

Режим текстового просмотра. Что нибудь подчеркивается. Значки предупреждения в виде дерева

Источник

Оцените статью