[BaseTransientBottomBar] 1.1.0-rc01 causes View.invalidate(boolean) NullPointerException
See original GitHub issueDescription: After updating from Material 1.0.0 to 1.1.0-rc01 I saw multiple reports of crashes with BaseTransientBottomBar (and no app specific code in stacktrace). Stacktraces look like: Huawei Android 7
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.invalidate(boolean)' on a null object reference
at android.view.View.setFlags + 11550(View.java:11550)
at android.view.View.setVisibility + 8046(View.java:8046)
at com.google.android.material.snackbar.BaseTransientBottomBar$9.run + 849(BaseTransientBottomBar.java:849)
at android.os.Handler.handleCallback + 761(Handler.java:761)
at android.os.Handler.dispatchMessage + 98(Handler.java:98)
at android.os.Looper.loop + 156(Looper.java:156)
at android.app.ActivityThread.main + 6617(ActivityThread.java:6617)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 942(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main + 832(ZygoteInit.java:832)
Samsung Android 9
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.invalidate(boolean)' on a null object reference
at android.view.View.setFlags + 15721(View.java:15721)
at android.view.View.setVisibility + 10789(View.java:10789)
at com.google.android.material.snackbar.BaseTransientBottomBar$9.run + 849(BaseTransientBottomBar.java:849)
at android.os.Handler.handleCallback + 873(Handler.java:873)
at android.os.Handler.dispatchMessage + 99(Handler.java:99)
at android.os.Looper.loop + 214(Looper.java:214)
at android.app.ActivityThread.main + 7094(ActivityThread.java:7094)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 494(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main + 975(ZygoteInit.java:975)
Xiaomi Android 9
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.invalidate(boolean)' on a null object reference
at android.view.View.setFlags + 14186(View.java:14186)
at android.view.View.setVisibility + 10007(View.java:10007)
at com.google.android.material.snackbar.BaseTransientBottomBar$9.run + 849(BaseTransientBottomBar.java:849)
at android.os.Handler.handleCallback + 873(Handler.java:873)
at android.os.Handler.dispatchMessage + 99(Handler.java:99)
at android.os.Looper.loop + 201(Looper.java:201)
at android.app.ActivityThread.main + 6823(ActivityThread.java:6823)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 547(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main + 873(ZygoteInit.java:873)
LGE Android 9
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.invalidate(boolean)' on a null object reference
at android.view.View.setFlags + 14222(View.java:14222)
at android.view.View.setVisibility + 10027(View.java:10027)
at com.google.android.material.snackbar.BaseTransientBottomBar$9.run + 849(BaseTransientBottomBar.java:849)
at android.os.Handler.handleCallback + 873(Handler.java:873)
at android.os.Handler.dispatchMessage + 99(Handler.java:99)
at android.os.Looper.loop + 193(Looper.java:193)
at android.app.ActivityThread.main + 6854(ActivityThread.java:6854)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 493(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main + 860(ZygoteInit.java:860)
(if needed I can find few more stacktrace, but they seem to differ just by line numbers)
Expected behavior: BaseTransientBottomBar should not cause crashes/NPE
Steps to reproduce are unfortunately unknown, it seems to be relatively rare. The issue did not happen in 1.0.0
Material Library version: 1.1.0-rc01
Device: Multiple Devices/Android OS versions affected.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:25 (10 by maintainers)
Top Results From Across the Web
java.lang.NullPointerException with boolean - Stack Overflow
Boolean instance with a primitive boolean , which means unboxing the java.lang.Boolean . Since null can't be unboxed, a NullPointerException is thrown.
Read more >How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >NullPointerException at androidx.compose.ui.platform ...
Hello, noticed a NPE crash in compose ui after updating from 1.1.0-alpha05 to 1.1.0-beta01. Crash happening in RenderNodeLayer.
Read more >Java NullPointerException - Detect, Fix, and Best Practices
Some of the common reasons for NullPointerException in java programs are: Invoking a method on an object instance but at runtime the object...
Read more >Fix "java.lang.NullPointerException" in Android Studio
Hey Geeks, today we will see what NullPointerException means and how we ... a default value set to it(Ex: True and False value...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Having same issue on Android 5, with
com.google.android.material:material:1.4.0
Fyi: Some issues are still present, see https://github.com/material-components/material-components-android/pull/1938. E.g.
As a possible workaround you might use
implementation 'com.github.material-components:material-components-android:d9fa78f176'
as jitpack-dependency, in that version the NPEs are resolved.@wcshi since the issue is only partially resolved, you might open this issue again.