question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ClassNotFoundException: "com.google.android.material.card.MaterialCardView"

See original GitHub issue

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

  • 28.0.0-alpha1

Operating system and device

Android P - Pixel 2xl

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
traiencommented, Jun 16, 2020

just add android:theme=“@style/Theme.MaterialComponents.Light” to com.google.android.material.card.MaterialCardView in xml and all will be fine

example: <com.google.android.material.card.MaterialCardView android:id=“@+id/subSectionsCardView” android:layout_width=“match_parent” android:layout_height=“match_parent” android:theme=“@style/Theme.MaterialComponents.Light” … etc

9reactions
dsn5ftcommented, Jun 4, 2018

You can use Material Components with 28.0.0-alpha1, the only difference is the package name. If using com.android.support:design:28.0.0-alpha1, you have to use android.support.design.* for all of the widgets. If using com.google.android.material:material:1.0.0-alpha1, you have to use com.google.android.material.*.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MaterialCardView crashes with material:1.1.0 - Stack Overflow
In my case I just added the android:theme="" attribute and it worked. My Material Card View ...
Read more >
MaterialCardView | Android Developers
This class supplies Material styles for the card in the constructor. The widget will display the correct default Material styles without the use ......
Read more >
Checkable CardView
Material card view ripple effect. Your card view contains relative layout ... Java lang NoClassDefFoundError com google android material R attr. java.lang.
Read more >
android.view.InflateException: Binary XML file line Code Example
InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class com.google.android.material.card.MaterialCardView · Caused by: ...
Read more >
Cards - Material Design
Making a card draggable · io.material.catalog.draggable.DraggableCoordinatorLayout · ="@+id/parentContainer" · > · com.google.android.material.card.MaterialCardView
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found