android – v7 RecyclerView NullPointerException AccessibilityDelegateCompat.getBridge()

在运行我的recyclerview列表片段时,我收到此错误

 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.support.v4.view.AccessibilityDelegateCompat.getBridge()' on a null object reference
    at android.support.v4.view.ViewCompat$ICSViewCompatImpl.setAccessibilityDelegate(ViewCompat.java:923)
    at android.support.v4.view.ViewCompat.setAccessibilityDelegate(ViewCompat.java:1343)
    at android.support.v7.widget.RecyclerView$Recycler.addViewHolderToRecycledViewPool(RecyclerView.java:3900)
    at android.support.v7.widget.RecyclerView$Recycler.recycleCachedViewAt(RecyclerView.java:3843)
    at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:3880)
    at android.support.v7.widget.RecyclerView$Recycler.recycleView(RecyclerView.java:3804)
    at android.support.v7.widget.RecyclerView$LayoutManager.removeAndRecycleViewAt(RecyclerView.java:5529)
    at android.support.v7.widget.LinearLayoutManager.recycleChildren(LinearLayoutManager.java:1139)
    at android.support.v7.widget.LinearLayoutManager.recycleViewsFromStart(LinearLayoutManager.java:1180)
    at android.support.v7.widget.LinearLayoutManager.recycleByLayoutState(LinearLayoutManager.java:1244)
    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1268)
    at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1102)
    at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:959)
    at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:1047)
    at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:1768)
    at android.view.View.dispatchTouchEvent(View.java:8388)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2424)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2158)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2314)
    at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1692)
    at android.app.Activity.dispatchTouchEvent(Activity.java:2739)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2275)
    at android.view.View.dispatchPointerEvent(View.java:8578)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4021)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3887)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3449)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.j
03-20 14:34:37.691: I/Process(9568): Sending signal. PID: 9568 SIG: 9

解决方法:

我删除了adt包中的支持库并重新安装.在我的项目中复制并粘贴支持v4 jar和support-v7-recyclerview.jar之后.现在它对我来说很好.

上一篇:Android Google Maps V2当前位置纬度经度NullPointerException


下一篇:Error:java:无效的源发行版:11