yasszu / bottom-navigation

Example of Android BottomNavigationView
https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView
132 stars 17 forks source link

Unable to get shift mode field #9

Open fctaddia opened 3 years ago

fctaddia commented 3 years ago

I run the method to disable shiftMode and in the logs it shows me this: D/TADDA: class Zx E/BottomNavigationHelper: Unable to get shift mode field java.lang.NoSuchFieldException: No field mShiftingMode in class LZx; (declaration of 'Zx' appears in /data/app/it.kenble.freddy-LA1SlQO9Eo5FCUafCf-YOw==/base.apk) at java.lang.Class.getDeclaredField(Native Method) at JG.b(:12) at it.kenble.freddy.ui.MainActivity.onCreate(:39) at android.app.Activity.performCreate(Activity.java:7458) at android.app.Activity.performCreate(Activity.java:7448) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1286) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3409) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86) 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:2199) at android.os.Handler.dispatchMessage(Handler.java:112) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7625) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

Let me know if it can be fixed. Thanks

yasszu commented 3 years ago

Thank you for your comment. This method is available at support library 27 or lower (android.support.design.internal.BottomNavigationMenuView). You are using a new library (com.google.android.material.bottomnavigation.BottomNavigationMenuView) in your app. My code is incorrect at the import declaration.

fctaddia commented 3 years ago

Ok thanks for your reply. Will there be an update to support the new library?

yasszu commented 3 years ago

If you want to use a Material Components, you have to migrate support library to AndroidX and add com.google.android.material:material:1.2.1 to the dependencies. Check out this docs: https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md