-1

I have a crash reported like:

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'android.view.View androidx.recyclerview.widget.RecyclerView$c0.a' on a null object reference
at com.xx.xx.Fragment$23$1.run(TestFragment.java:4)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

How to find the androidx.recyclerview.widget.RecyclerView$c0.a? Where is the crash happening?

Absolutely nothing to do with NullPointerExceptions. This question is about finding variables names in Crashlytics reports when classes are not symbolicated in the crashlog.

iColorama
  • 223
  • 3
  • 11
  • Absolutely nothing to do with it, can't you read? It is about finding variables names in Crashlytics reports when classes are not symbolicated in the crashlog. – iColorama Nov 17 '19 at 23:47
  • Well, the crash report says it's happening on line 4 of `TestFragment.java`. Start by looking at that file, and including relevant parts in the question? – Dan Getz Nov 18 '19 at 04:18
  • @DanGetz the report was not symbolicated, in line 4 there is nothing otherwise I would not ask. The question has already been answered. – iColorama Nov 18 '19 at 21:29

1 Answers1

1

Have a look at the next row in the report:

at com.xx.xx.Fragment$23$1.run(TestFragment.java:4)

where $23$1 is the first inner class in the 23th inner class in your fragment. From the stacktrace it looks like a Runnable posted to a Handler.

It's your RecyclerView that is null there but in case you want to decode what specific field the obfuscated name c0.a corresponds to, have a look at mapping.txt belonging to that build (can be found in build/outputs/mapping directory).

laalto
  • 150,114
  • 66
  • 286
  • 303
  • Thanks so much, this not for humans) I got his: androidx.recyclerview.widget.RecyclerView$ViewHolder -> androidx.recyclerview.widget.RecyclerView$c0: boolean mInChangeScrap -> o int mIsRecyclableCount -> m int mFlags -> j long mItemId -> e androidx.recyclerview.widget.RecyclerView mOwnerRecyclerView -> r java.util.List FULLUPDATE_PAYLOADS -> s androidx.recyclerview.widget.RecyclerView$Recycler mScrapContainer -> n android.view.View itemView -> a – iColorama Nov 17 '19 at 17:32
  • Should not this found by Crashlytics? Maybe I should submit the map somehow? Thanks so much again! I think I found the place, amazing help! – iColorama Nov 17 '19 at 17:41
  • 1
    Usually the fabric/crashlytics gradle plugin takes care of the mapping file yes. – laalto Nov 17 '19 at 17:57
  • "It's your `RecyclerView` that is null there" – Hmm, that's not how I'm reading that: `Attempt to read from field '...View ...RecyclerView$c0.a' on a null object reference`. That would mean `RecyclerView$c0` is null, not the `RecyclerView`, yeah? A null `ViewHolder`. Anyhoo, just nitpicking. Cheers! – Mike M. Nov 18 '19 at 03:04
  • @MikeM the code is question: new Handler().postDelayed(new Runnable() { public void run() { mRvFilters.scrollToPosition(0); new Handler().postDelayed(new Runnable() { public void run() { mRecycleView.findViewHolderForAdapterPosition(pos).itemView .performClick(); } }, 300); } }, 400); – iColorama Nov 18 '19 at 21:20
  • Basically a terrible hack for scrolling a recyclerview to the start and click on the first item. I added a catch to findViewHolderForAdapterPosition and the crash disappeared. Not so sure it will always work :( – iColorama Nov 18 '19 at 21:22
  • I'm very grateful for the help, as it was a very urgent issue. I can't understand why some reports are not symbolicated. I'm in Catalina..maybe that? I will try to contact Firebase support and ask why! Thanks again! – iColorama Nov 18 '19 at 21:27