Assigned
Status Update
Comments
ma...@google.com <ma...@google.com> #2
error instantiating androidx.tracing.perfetto.StartupTracingConfigStoreIsEnabledGate
This looks like a minification issue
- Are you using either minification of your app, or in your instrumented test? If so, can you try adding a keep rule for that class?
- Is this class present in your apk's dex files, if you open the apk in studio? (if this is an instrumented test, check both your app and test)
- Are you depending on
androidx.compose.runtime:runtime-tracing
viaandroidTestImplementation
orimplementation
, and from what type of module? - What version of AGP are you using? I would expect the
would mean the library doesn't need an explicit keep rule, but it could bemanifest entry for this class depending on your AGP version / how the dependency is declared (fixed in AGP 8.6 canary 5, but a keep rule should work around it)b/328649293
Edit: disregard, I doubt Robolectric is using any of the minification codepaths.
ra...@google.com <ra...@google.com> #3
- Let me check
- Using
implementation
and it's added at the project level so all modules using compose are getting it - I'm on
8.1.1
ma...@google.com <ma...@google.com> #4
Search in Google's internal codebase for TraceHelper
to see our wrapper.
Description
Component used: androidx.tracing Version used: 1.1.0
Hi there, using the AndroidX tracing API requires matching the opening and closing spans like this:
Or, to be careful if
x
can throw:This is a bit manual, tedious, error-prone, etc. Easy to mismatch. We've seen in our app many cases where sections don't get closed symmetrically.
We've had some success in our app with a java try-with-resources wrapper:
Now all our trace spans are automatically closed at the end of the brace.
I think this could be useful for other apps to alleviate some of the tedium of closing traces symmetrically, and would make a worthy addition to the androidx library.
To ensure we support old-ish versions of java, we should make sure
Section
implementsjava.io.Closeable
rather than the new java8+java.lang.AutoCloseable
. In practice if you make theSection
class final then the compiler understands theclose()
method can't throw IOException and doesn't make callers catchIOException
.