[BottomNavigationView] Component not rendered in preview
Description: BottomNavigationView not rendering properly in XML Design
Expected behavior: BottomNavigationView renders correctly
Source code:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/bottom_navigation_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
Android API version: API 30
Material Library version: 1.5.0-alpha05 (tried also alpha04)
Device: Pixel 3 XL API 29 & Pixel 5 API 30

For me, it's not even working on test devices. I'm using 1.5.0-alpha05 material library. P.S. I mean the bottom nav bar is in old style, not "material you".
I think this has been fixed. Feel free to reopen it if it's still reproducible.
I think this has been fixed. Feel free to reopen it if it's still reproducible.
I've tried, it doesn't work, same problem...
+1 here, 1.5.0 stable
Still having the same problem in 1.5.0 - I'm getting: The following classes could not be instantiated: - com.google.android.material.bottomnavigation.BottomNavigationView
Exception Details: java.lang.IllegalArgumentException: Motion easing theme attribute must be a string at com.google.android.material.motion.MotionUtils.resolveThemeInterpolator
Only going back to 1.4.0 seems to work.
Hello, can you check if this is still an issue with the latest Canary build of Android Studio? If so I think a bug should be filed for Android Studio.
Still failed, Build #AI-213.7172.25.2113.9123335, built on September 30, 2022
dependencies {
....
implementation 'com.google.android.material:material:1.5.0'
....
}
Got the following when I tried to add BottomNavigationView inside a Constraint Layout
The following classes could not be instantiated:
- com.google.android.material.bottomnavigation.BottomNavigationView (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout.
Exception Details java.lang.IllegalArgumentException: Motion easing theme attribute must be a string java.lang.IllegalArgumentException: Motion easing theme attribute must be a string
at com.google.android.material.motion.MotionUtils.resolveThemeInterpolator(MotionUtils.java:59)
at com.google.android.material.navigation.NavigationBarMenuView.<init>(NavigationBarMenuView.java:121)
at com.google.android.material.bottomnavigation.BottomNavigationMenuView.<init>(BottomNavigationMenuView.java:48)
at com.google.android.material.bottomnavigation.BottomNavigationView.createNavigationBarMenuView(BottomNavigationView.java:215)
at com.google.android.material.navigation.NavigationBarView.<init>(NavigationBarView.java:162)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:108)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:103)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:98)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:351)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:200)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:161)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:294)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1127)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1130)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
at android.view.LayoutInflater.inflate(LayoutInflater.java:505)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:359)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:717)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:873)
at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:192)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
dependencies { .... implementation 'com.google.android.material:material:1.5.0' .... }Got the following when I tried to add
BottomNavigationViewinside aConstraint LayoutThe following classes could not be instantiated: - com.google.android.material.bottomnavigation.BottomNavigationView (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.IllegalArgumentException: Motion easing theme attribute must be a string java.lang.IllegalArgumentException: Motion easing theme attribute must be a string at com.google.android.material.motion.MotionUtils.resolveThemeInterpolator(MotionUtils.java:59) at com.google.android.material.navigation.NavigationBarMenuView.<init>(NavigationBarMenuView.java:121) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.<init>(BottomNavigationMenuView.java:48) at com.google.android.material.bottomnavigation.BottomNavigationView.createNavigationBarMenuView(BottomNavigationView.java:215) at com.google.android.material.navigation.NavigationBarView.<init>(NavigationBarView.java:162) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:108) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:103) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:98) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:351) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:200) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:161) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:294) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1127) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1130) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.inflate(LayoutInflater.java:686) at android.view.LayoutInflater.inflate(LayoutInflater.java:505) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:359) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:717) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:873) at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:192) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)
I have the exact same issue. Is this issue fixed ?
dependencies { .... implementation 'com.google.android.material:material:1.5.0' .... }Got the following when I tried to add
BottomNavigationViewinside aConstraint LayoutThe following classes could not be instantiated: - com.google.android.material.bottomnavigation.BottomNavigationView (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.IllegalArgumentException: Motion easing theme attribute must be a string java.lang.IllegalArgumentException: Motion easing theme attribute must be a string at com.google.android.material.motion.MotionUtils.resolveThemeInterpolator(MotionUtils.java:59) at com.google.android.material.navigation.NavigationBarMenuView.<init>(NavigationBarMenuView.java:121) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.<init>(BottomNavigationMenuView.java:48) at com.google.android.material.bottomnavigation.BottomNavigationView.createNavigationBarMenuView(BottomNavigationView.java:215) at com.google.android.material.navigation.NavigationBarView.<init>(NavigationBarView.java:162) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:108) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:103) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:98) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:351) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:200) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:161) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:294) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1127) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1130) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.inflate(LayoutInflater.java:686) at android.view.LayoutInflater.inflate(LayoutInflater.java:505) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:359) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:717) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:873) at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:192) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)I have the exact same issue. Is this issue fixed ?
It was fixed after downgrading the material dependency to 1.4.0.
dependencies {
....
implementation 'com.google.android.material:material:1.4.0'
....
}
This issue is fixed with material version 1.8.0
dependencies { .... implementation 'com.google.android.material:material:1.5.0' .... }Got the following when I tried to add
BottomNavigationViewinside aConstraint LayoutThe following classes could not be instantiated: - com.google.android.material.bottomnavigation.BottomNavigationView (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.IllegalArgumentException: Motion easing theme attribute must be a string java.lang.IllegalArgumentException: Motion easing theme attribute must be a string at com.google.android.material.motion.MotionUtils.resolveThemeInterpolator(MotionUtils.java:59) at com.google.android.material.navigation.NavigationBarMenuView.<init>(NavigationBarMenuView.java:121) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.<init>(BottomNavigationMenuView.java:48) at com.google.android.material.bottomnavigation.BottomNavigationView.createNavigationBarMenuView(BottomNavigationView.java:215) at com.google.android.material.navigation.NavigationBarView.<init>(NavigationBarView.java:162) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:108) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:103) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:98) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:351) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:200) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:161) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:294) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1127) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1130) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088) at android.view.LayoutInflater.inflate(LayoutInflater.java:686) at android.view.LayoutInflater.inflate(LayoutInflater.java:505) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:359) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:717) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:873) at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:192) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)I have the exact same issue. Is this issue fixed ?
It was fixed after downgrading the
materialdependency to1.4.0.dependencies { .... implementation 'com.google.android.material:material:1.4.0' .... }
yes it works 1.4.0