[BottomNavigationView] Crash when inflating Menu
See original GitHub issueDescription: When using app:menu attribute, app crashes. When its empty, app runs normally.
Expected behavior: Expects to correct inflate menu.
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:id=“@+id/doors_activity_id” android:layout_width=“match_parent” android:layout_height=“match_parent”>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
app:elevation="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/mainBackground"
/>
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="@+id/frameContainer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout">
</FrameLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_navigation_menu"/>
</androidx.constraintlayout.widget.ConstraintLayout>`
Android API version: Api 28
Material Library version: Material Android Library version you are using here (e.g., 1.1.0-Beta01)
Device: Occurs on Simulator and on Physical Device
Stacktrack:
E/AndroidRuntime: FATAL EXCEPTION: main Process: br.com.loopkey.indigo, PID: 6621 java.lang.NoSuchFieldError: No static field smallLabel of type I in class Lcom/google/android/material/R$id; or its superclasses (declaration of 'com.google.android.material.R$id' appears in /data/app/br.com.loopkey.indigo-cXAvVjFvNTsdqhGXDjsjMw==/base.apk!classes2.dex) at com.google.android.material.bottomnavigation.BottomNavigationItemView.<init>(BottomNavigationItemView.java:97) at com.google.android.material.bottomnavigation.BottomNavigationItemView.<init>(BottomNavigationItemView.java:84) at com.google.android.material.bottomnavigation.BottomNavigationItemView.<init>(BottomNavigationItemView.java:80) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.getNewItem(BottomNavigationMenuView.java:588) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.buildMenuView(BottomNavigationMenuView.java:520) at com.google.android.material.bottomnavigation.BottomNavigationPresenter.updateMenuView(BottomNavigationPresenter.java:67) at com.google.android.material.bottomnavigation.BottomNavigationView.inflateMenu(BottomNavigationView.java:343) at br.com.loopkey.indigo.presentation.view.activity.DoorActivity._setupBottomNavigation(DoorActivity.kt:78) at br.com.loopkey.indigo.presentation.view.activity.DoorActivity.onCreate(DoorActivity.kt:43) at android.app.Activity.performCreate(Activity.java:7224) at android.app.Activity.performCreate(Activity.java:7213) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2926) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3081) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:201) at android.app.ActivityThread.main(ActivityThread.java:6806) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (5 by maintainers)
Top GitHub Comments
same here
I am also facing this issue. My app is working perfectly on android 9 and android 7. But it is not working on android 5. It is giving this on logcat
BottomNavigationView XML