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.

MaterialComponentsViewInflater ClassNotFoundException

See original GitHub issue

Overview

When using Theme.MaterialComponents theme, the following error can be found in logcat. It won’t crash the app though.

2018-05-21 19:57:17.821 4193-4193/com.example.demo I/AppCompatDelegate: Failed to instantiate custom view inflater com.google.android.material.theme.MaterialComponentsViewInflater . Falling back to default.
    java.lang.ClassNotFoundException: Invalid name: com.google.android.material.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 androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1226)
        at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1297)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1885)
        at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2599)
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2672)
        at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2071)
        at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:566)
        at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:509)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:457)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at com.example.demo.MainActivity.onCreate(MainActivity.java:13)
        at android.app.Activity.performCreate(Activity.java:7130)
        at android.app.Activity.performCreate(Activity.java:7121)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1262)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2905)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3060)
        at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:4792)
        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4711)
        at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:110)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
        at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:55)
        at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:4753)
        at android.app.Activity.recreate(Activity.java:5580)
        at com.example.demo.MainActivity.onClick(MainActivity.java:30)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25881)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        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)

Reproduction steps

Use Theme.MaterialComponents for an activity and start the activity. The light theme doesn’t have the error.

This can also be reproduced using Theme.MaterialComponents.Dialog and Theme.MaterialComponents.Dialog.Light theme.

Version number

1.0.0-alpha1

Operating system and device

Android P PPP2.180412.012

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
NickM-27commented, Jun 2, 2018

I am also having this error, on debug, and I made sure to add it to proguard as well

0reactions
dsn5ftcommented, Jun 18, 2018

Yep this issue has been addressed. Thanks for reporting it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android studio render error in design view - Stack Overflow
java.lang.NoClassDefFoundError: Could not initialize class com.google.android.material.theme.MaterialComponentsViewInflater at ...
Read more >
MaterialComponentsViewInflater - Android Developers
An extension of AppCompatViewInflater that replaces some framework widgets with Material Components ones at inflation time, provided a Material ...
Read more >
Why Do I Get A Theming Error Just After Using Proguard - ADocLib
ClassNotFoundException : Didn't find class "android.view.Button" on path: createButton(MaterialComponentsViewInflater.java:43) at androidx.appcompat.app.
Read more >
https://issuetracker.google.com/action/issues/2034...
Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. ... MaterialComponentsViewInflater using the no-argument # constructor.
Read more >
AutoResponder for Telegram v2.6.9 Premium Mod Apk ...
MaterialComponentsViewInflater. Ansi based on Memory/File Scan (1c6836ee9c417b4aa4695ec216f356c6674e06743f7341602c0737daf7935e5e.apk).
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