java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference

Stack Overflow | bluemunch | 10 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    NullPointerException on Facebook Native Ads layout with RecyclerAdapter

    Stack Overflow | 10 months ago | bluemunch
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference
  2. 0

    Facebook Native Ads with RecyclerAdapter

    Stack Overflow | 10 months ago | bluemunch
    java.lang.NullPointerException: Attempt to invoke virtual method 'com.facebook.ads.NativeAd com.facebook.ads.NativeAdsManager.nextNativeAd()' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference

      at com.elgami.feed.FeedRecyclerAdapter.onBindViewHolder()
    2. com.elgami.feed
      FeedRecyclerAdapter.onBindViewHolder
      1. com.elgami.feed.FeedRecyclerAdapter.onBindViewHolder(FeedRecyclerAdapter.java:128)
      1 frame
    3. Android v7
      RecyclerView.onLayout
      1. android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:5768)
      2. android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:5801)
      3. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5037)
      4. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4913)
      5. android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2029)
      6. android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1414)
      7. android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1377)
      8. android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:578)
      9. android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3260)
      10. android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3069)
      11. android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3518)
      11 frames
    4. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:16636)
      2. android.view.ViewGroup.layout(ViewGroup.java:5437)
      2 frames
    5. Android Support v4
      SwipeRefreshLayout.onLayout
      1. android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:598)
      1 frame
    6. Android Platform
      FrameLayout.onLayout
      1. android.view.View.layout(View.java:16636)
      2. android.view.ViewGroup.layout(ViewGroup.java:5437)
      3. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
      4. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
      5. android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
      6. android.view.View.layout(View.java:16636)
      7. android.view.ViewGroup.layout(ViewGroup.java:5437)
      8. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
      9. android.view.View.layout(View.java:16636)
      10. android.view.ViewGroup.layout(ViewGroup.java:5437)
      11. android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
      12. android.widget.FrameLayout.onLayout(FrameLayout.java:273)
      13. android.view.View.layout(View.java:16636)
      14. android.view.ViewGroup.layout(ViewGroup.java:5437)
      15. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
      16. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
      17. android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
      18. android.view.View.layout(View.java:16636)
      19. android.view.ViewGroup.layout(ViewGroup.java:5437)
      20. android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
      21. android.widget.FrameLayout.onLayout(FrameLayout.java:273)
      22. android.view.View.layout(View.java:16636)
      23. android.view.ViewGroup.layout(ViewGroup.java:5437)
      24. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
      25. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
      26. android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
      27. android.view.View.layout(View.java:16636)
      28. android.view.ViewGroup.layout(ViewGroup.java:5437)
      29. android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
      30. android.widget.FrameLayout.onLayout(FrameLayout.java:273)
      30 frames
    7. Android
      PhoneWindow$DecorView.onLayout
      1. com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
      1 frame
    8. Android Platform
      Choreographer$FrameDisplayEventReceiver.run
      1. android.view.View.layout(View.java:16636)
      2. android.view.ViewGroup.layout(ViewGroup.java:5437)
      3. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
      4. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
      5. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
      6. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
      7. android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
      8. android.view.Choreographer.doCallbacks(Choreographer.java:670)
      9. android.view.Choreographer.doFrame(Choreographer.java:606)
      10. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
      10 frames