Add a fallback for detecting whether an app is a flutter app in profile mode
When running in Debug mode. Devtools>>performance tab look this.
When running in Profile mode or in release mode. Devtools>>performance tab look this.
Isn't Flutter frames button, bar graph and other missing options should also visible for profile and release mode?
Any update??
Do you have a consistent repro for this? I haven't been able to reproduce.
@kenzieschmoll can't share you the repo in which the issue is coming. But i tried it with other repos by creating new ones, but works as expected. Not sure what is issue related to.
@dheerajverma009 please provide a repro case if you can, otherwise this issue will automatically close. Thanks.
@kenzieschmoll Looks like it is specific to my project. I tried creating other projects with same version but seems they are showing frame graph as expected. Can you give some suggestion what could be wrong.
It appears that your app is not being detected as a Flutter app in profile mode. We are looking for the presence of a specific library in your application: https://github.com/flutter/devtools/blob/master/packages/devtools_app_shared/lib/src/service/connected_app.dart/#L16.
This should be available for a standard flutter app. Is there something about your app that would make this library not present in profile mode?
@kenzieschmoll
After debugging, I found that
extra-gen-snapshot-options=--obfuscate inside gradle.properties was responsible for above scenario.
I don't know why it was causing the frame graph to not appear.
@bkonyi @dnfield do you know why extra-gen-snapshot-options=--obfuscate would cause this?
From https://github.com/dart-lang/sdk/issues/30524:
At the end of precompilation we also collect and rename scripts, libraries and Symbol instances. Libraries and scripts URI are also renamed.
If you're relying on a particular library being present and looking for it by name, you won't be able to find it since it'll have been obfuscated.
If you're relying on a particular library being present and looking for it by name, you won't be able to find it since it'll have been obfuscated.
Will this only be the case in profile mode? It appears that debug mode worked fine for this user.
Probably since debug mode uses the JIT and --obfuscate is only used when generating AOT snapshots with gen_snapshot (as far as I know).
Got it. We can fix this by adding a fallback check in profile mode. One idea is to check that an arbitrary Flutter service extension is available for the connected app, though we may have some race / timing issues with performing this check at the time that we initialize the connected app.