Skip to content
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

PerformanceMetricsState$Companion.getHolderForHierarchy crash #1723

Open
ihermandev opened this issue Nov 15, 2023 · 9 comments
Open

PerformanceMetricsState$Companion.getHolderForHierarchy crash #1723

ihermandev opened this issue Nov 15, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@ihermandev
Copy link

Describe what happened
I encountered a ClassCastException error when using the androidx.metrics:metrics-performance library version 1.0.0-alpha04, which is included in the com.datadoghq:dd-sdk-android-rum package.

Fatal Exception: java.lang.ClassCastException
androidx.metrics.performance.DelegatingFrameMetricsListener cannot be cast to androidx.metrics.performance.PerformanceMetricsState$Holder

Steps to reproduce the issue:
Don't know to be honest it just happens randomly

Additional context

  • Android OS version: 13
  • Device Model: Galaxy S21 FE 5G
  • Datadog SDK version: 2.2.0
@ihermandev ihermandev added the bug Something isn't working label Nov 15, 2023
@0xnm
Copy link
Contributor

0xnm commented Nov 15, 2023

Hello @ihermandev! Thanks for opening the issue. Can you please post the full stacktrace of the error happening?

@ihermandev
Copy link
Author

ihermandev commented Nov 16, 2023

Sure, the full stacktrace is

Fatal Exception: java.lang.ClassCastException: androidx.metrics.performance.DelegatingFrameMetricsListener cannot be cast to androidx.metrics.performance.PerformanceMetricsState$Holder
       at androidx.metrics.performance.PerformanceMetricsState$Companion.getHolderForHierarchy(PerformanceMetricsState.kt:367)
       at androidx.metrics.performance.DelegatingFrameMetricsListener.onFrameMetricsAvailable(JankStatsApi24Impl.kt:225)
       at android.view.FrameMetricsObserver.onFrameMetricsAvailable(FrameMetricsObserver.java:59)
       at android.graphics.HardwareRendererObserver.lambda$notifyDataAvailable$0$android-graphics-HardwareRendererObserver(HardwareRendererObserver.java:94)
       at android.graphics.HardwareRendererObserver$$ExternalSyntheticLambda0.run(:2)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.os.HandlerThread.run(HandlerThread.java:67)

@0xnm
Copy link
Contributor

0xnm commented Nov 16, 2023

Hello @ihermandev! Thanks for sharing stacktrace (I edited it and removed non-relevant threads).

It seems that it is a bug in the androidx.metrics:metrics-performance library we are using under the hood. Can you please check its version resolved for your application? You can run dependencies task for the module where you add our SDK to see the list of the dependencies.

@ihermandev
Copy link
Author

The version is 1.0.0-alpha04

@0xnm
Copy link
Contributor

0xnm commented Nov 16, 2023

I've opened a bug in the Google Issue Tracker, you can star it to see the updates.

@ihermandev
Copy link
Author

Great! Thank you for the assistance.

1 similar comment
@ihermandev
Copy link
Author

Great! Thank you for the assistance.

@Aetherna
Copy link

Aetherna commented Apr 5, 2024

Guys I just saw this happen. Triggered by opening the app from a deeplink, if that changes anything.
.main.MainActivity cannot be cast to androidx.metrics.performance.PerformanceMetricsState$Holder

@0xnm
Copy link
Contributor

0xnm commented Apr 5, 2024

@Aetherna this is an issue in androidx.metrics:metrics-performance library and was reported here. Once fix is out we will update the library used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants