question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NPE In BottomSheetBehavior ViewDragHelper

See original GitHub issue

Description: Crash (see logs below)

Expected behavior: Not to crash

Android API version: 8.1.0

Material Library version: com.google.android.material:material:1.2.0-alpha06

Device: Moto G (5) Plus

More Info: From Android issue tracker:

Looks like this is in https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java#L512 which should be filed on https://github.com/material-components/material-components-android/issues

There’s already a null check earlier in that method at https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java#L498 so probably the same defensive check needs to be done everywhere viewDragHelper is used. Going to close this here - please refile in the Github tracker.

V8 is the obfuscated name of ViewDragHelper, and b is mTouchSlop.

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'int V8.b' on a null object reference
       at androidx.customview.widget.ViewDragHelper.getTouchSlop(ViewDragHelper.java:503)
       at com.google.android.material.bottomsheet.BottomSheetBehavior.onTouchEvent(BottomSheetBehavior.java:512)
       at androidx.coordinatorlayout.widget.CoordinatorLayout.performIntercept(CoordinatorLayout.java:505)
       at androidx.coordinatorlayout.widget.CoordinatorLayout.onTouchEvent(CoordinatorLayout.java:557)
       at android.view.View.dispatchTouchEvent(View.java:11779)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2965)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2643)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2971)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
       at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:477)
       at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1835)
       at android.app.Activity.dispatchTouchEvent(Activity.java:3326)
       at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
       at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:1)
       at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:439)
       at android.view.View.dispatchPointerEvent(View.java:12018)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4829)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4643)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4181)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4234)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4200)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4327)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4208)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4384)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4181)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4234)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4200)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4208)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4181)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6744)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6683)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6644)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6847)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:193)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:325)
       at android.os.Looper.loop(Looper.java:142)
       at android.app.ActivityThread.main(ActivityThread.java:6626)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
matpagcommented, Aug 5, 2020

Nope, this will be in the next 1.3.0

0reactions
eygrabercommented, Aug 5, 2020

Did this make it into 1.2.0?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException in bottomsheetbehavior (only in release ...
I am getting NPE (NullPointerException) on BottomSheetBehavior only when build variant is in release mode. If i test with debug variant it is ......
Read more >
NullPointerException in ViewDragHelper support-v4 23.2.0 ...
Hey !! The tester in our team found this when "playing" with a recyclerView using your brand new behavior android.support.design.widget.
Read more >
Diff - 8f786a2^! - platform/frameworks/base - Git at Google
setCustomView(null) results in NullPointerException + (<a ... issue 212945</a>) + </li> + + <li>BottomSheetBehavior expands to old content height when using ...
Read more >
Support Library Revision Archive - Android Developers
ViewDragHelper.saveLastMotion() throws ArrayIndexOutOfBoundsException (AOSP issue 212945); BottomSheetBehavior expands to old content height ...
Read more >
ChiliLabs - Bountysource
continueSettling(ViewDragHelper.java:779) at com.google.android.material.bottomsheet.BottomSheetBehavior$SettleRunnable.run(BottomSheetBehavior.java:1542).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found