Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get shift mode field #9

Open
fctaddia opened this issue Jan 5, 2021 · 3 comments
Open

Unable to get shift mode field #9

fctaddia opened this issue Jan 5, 2021 · 3 comments

Comments

@fctaddia
Copy link

fctaddia commented Jan 5, 2021

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)

  • TADDA is a custom name of my log

  • at it.kenble.freddy.ui.MainActivity.onCreate(:39) --> if (Build.VERSION.SDK_INT >= 27) binding.bottomNavigation.disableShiftMode()

  • I also added this in the proguard-roles file:
    -keepclassmembers class android.support.design.internal.BottomNavigationMenuView {
    boolean mShiftingMode;
    }

  • I'm using this as a global theme: Theme.MaterialComponents.Light.NoActionBar, I don't know if it affects anything.

Let me know if it can be fixed. Thanks

@yasszu
Copy link
Owner

yasszu commented Jan 8, 2021

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
Copy link
Author

fctaddia commented Jan 9, 2021

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

@yasszu
Copy link
Owner

yasszu commented Jan 11, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants