New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HEAP ANALYSIS FAILED: KotlinNullPointerException #2527
Comments
This is crashing here: https://github.com/square/leakcanary/blob/main/shark/shark-android/src/main/java/shark/AndroidObjectInspectors.kt#L857 val state = this["androidx.lifecycle.LifecycleRegistry", "mState"]!!.valueAsInstance!! I did repro with Splitting the code into two lines: val field = this["androidx.lifecycle.LifecycleRegistry", "mState"]!!
val state = field.valueAsInstance!! I see that the NPE is on: this["androidx.lifecycle.LifecycleRegistry", "mState"]!! This implies that I then changed the code to dump the list of fields in the error: val field = this["androidx.lifecycle.LifecycleRegistry", "mState"]
if (field == null) {
val fields = readFields().joinToString("\n") { "${it.name}: ${it.value.holder}" }
error("mState field doesn't exist. Fields:\n$fields")
}
val state = field.valueAsInstance!! Which gives me:
No Looking at the Android X sources, LifecycleRegistry was converted to Kotlin on 2022-11-16 and the Changing the LeakCanary to look for
|
The source of your leak is most likely that #2528 has the fix for the crash but LeakCanary 3 won't be released for a while. |
Great! Thanks for the analysis, we've fixed that leak. 💪🏻 |
LeakCanary 2.12 has been released with the fix. |
2023-06-01_14-19-24_248.zip
Also reproducible with
shark-cli
and this hprof file.The text was updated successfully, but these errors were encountered: