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

Error: No named parameter with the name 'forceDirectlyCallNextVsyncTargetTime'. #182

Open
2697a opened this issue Feb 3, 2023 · 33 comments

Comments

@2697a
Copy link

2697a commented Feb 3, 2023

Describe the bug
I used a custom engine and a custom Flutter, but there was an error during compilation. I can't find the reason
Error: No named parameter with the name 'forceDirectlyCallNextVsyncTargetTime'.
Error: Member not found: 'PlatformDispatcher.pointerDataPacketStorageReadPendingAndClear'.

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@welcome
Copy link

welcome bot commented Feb 3, 2023

Hi! Thanks for opening your first issue here! 😄

@2697a
Copy link
Author

2697a commented Feb 3, 2023

128441675410259_ pic_hd
The engine should be right

@fzyzcjy
Copy link
Owner

fzyzcjy commented Feb 3, 2023

Hi, have you used the engine and flutter under fzyzcjy/ and the correct branch?

@2697a
Copy link
Author

2697a commented Feb 3, 2023

https://github.com/fzyzcjy/flutter/tree/flutter-smooth
https://github.com/fzyzcjy/engine/tree/flutter-smooth
Yes, I forked the two warehouses and switched to Flutter_ Smooth branch, sorry my English is not very good

@fzyzcjy
Copy link
Owner

fzyzcjy commented Feb 3, 2023

So, looks like the function is there, but your environment somehow does not pick up it?

You need to build the whole engine by yourself, i.e. compile that large C++ codebase

@2697a
Copy link
Author

2697a commented Feb 3, 2023

Thank you. I'm trying. I don't know if it's related to the Mac m1 chip

@fzyzcjy
Copy link
Owner

fzyzcjy commented Feb 3, 2023

You are welcome

@jmquilez
Copy link

jmquilez commented Jul 8, 2023

Hello! Any updates on this? I am having the exact same problem but on Windows 10, I'm able to compile the custom engine and when I set the dependency_overrides for sky_engine even visual studio code shows no error on the named parameter above if I call it from my own project (it did show an error message before setting the sky_engine override), however at the time of running the app, flutter does not seem to use the custom sky_engine and instead uses the default one; I've checked that I'm using the correct branch and the correct version of both the engine and the flutter framework, however as @fzyzcjy previously said it is as if the environment weren't picking the custom engine. The weirdest part is that even visual studio code detects the custom engine, but flutter does not as I mentioned above. I have also checked the platform I am compiling the engine for is the right one (android). Any help would be much appreciated.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 8, 2023

flutter does not seem to use the custom sky_engine and instead uses the default one

Hmm, did you follow the official Flutter doc about picking the custom engine from framework?

@jmquilez
Copy link

jmquilez commented Jul 9, 2023

Hey again! Yes, I believe so. Here are the steps I followed to do it (I tried both optimized and unoptimized builds, for Windows and Android):

FOR ENGINE:
1) cd C:\Apps
2) git clone --branch flutter-smooth https://github.com/fzyzcjy/engine.git smooth_engine
3) cd smooth_engine
4) create ".gclient" (type nul > .gclient) file & set its contents to "solutions = [ { "managed": False, "name": "src/flutter", "url": "https://github.com/fzyzcjy/engine.git@fae3401eef162e2e17674895d4cc556be8ace1e7", "custom_deps": {}, "deps_file": "DEPS", "safesync_url": "", }, ]"
5) set DEPOT_TOOLS_WIN_TOOLCHAIN=0
6) set GYP_MSVS_VERSION=2019
7) set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
8) set WINDOWSSDKDIR=C:\Program Files (x86)\Windows Kits\10
9) gcloud auth login
10) gcloud auth application-default login
11) gclient sync -D (removing the "-D" has no further effect)
12) cd src/flutter
13) git checkout flutter-smooth
14) gclient sync -D --> just in case
15) cd ../
FOR NON-PROFILE NOR RELEASE MODE IN BELOW STEPS, ADD "--UNOPTIMIZED" FLAG
16) .\flutter\tools\gn --runtime-mode=profile && .\flutter\tools\gn --android --runtime-mode=profile
17) ninja -C out/host_profile && ninja -C out/android_profile

FOR FLUTTER (FRAMEWORK) AND SMOOTH PACKAGE:
cd ../../
git clone --branch flutter-smooth https://github.com/fzyzcjy/flutter.git smooth_flutter
git clone https://github.com/fzyzcjy/flutter_smooth.git flutter_smooth
(and set default "flutter" path to the executable under smooth_flutter/bin)

Then, set _dependency overrides_ for sky_engine package in the desired project (more about this on the videos below)

I have tried everything I've been able to and still, it seems like flutter is just not picking the custom engine. If I missed any steps when building or running, please let me know a better way to do it. I also made a modification to C:\Apps\smooth_flutter\packages\flutter_tools\gradle\flutter.gradle, so that the "useLocalEngine" function there is to determine whether the app should use a local engine (as in the case of sky_engine) or not shows an error message stating this boolean value at the time of compiling the app; and it actually prints "false" onscreen, something that does not happen when specifying local-engine-src-path and local-engine options (prints true) through cmd (although we cannot do this, because the engine modifies a file from dart:ui, forcing us to use a sky_engine dependency override). Here is modified code of that function, line 621 of C:\Apps\smooth_flutter\packages\flutter_tools\gradle\flutter.gradle:

private Boolean useLocalEngine() {
    project.logger.error("UseLocalEngine: ${project.hasProperty('local-engine-repo')}")
    return project.hasProperty('local-engine-repo')
}

Finally, here are three videos (.gif format) of all the errors mentioned:

  1. Vscode autocorrect recognizing the custom engine

vscode-noerror

  1. Another one of an error message which states that I should set a dependency override for sky_engine (although I already have, when I saw this I thought flutter was pulling my leg or something)

contradiction-error

  1. And a last one which shows the project compilation errors (like not detecting the custom engine, in the logs of this last video it is also possible to see the useLocalEngine: false custom logs from C:\Apps\smooth_flutter\packages\flutter_tools\gradle\flutter.gradle that I mentioned before).

compilation-error

Thank you so much for your attention and support.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 9, 2023

I am not an expert in compiling engine in windows (I am on MacOS). So just guesses here: When running it, have you tried https://github.com/flutter/flutter/wiki/The-flutter-tool#using-a-locally-built-engine-with-the-flutter-tool to ensure flutter framework pick up the right engine? If not, you compiled the engine but not use it when running Flutter code.

@jmquilez
Copy link

Hi again! Yes, I have tried it. After uncountable attempts, I have finally been able to compile the app without errors, but there are a few issues that I will talk about more in-depth when I post a report on this in a near future (maybe tomorrow or in a few days). To say it briefly, I renamed the smooth_engine directory to just engine so it is a neighbour of the flutter framework directory with the name engine, this way I didn't have to change the $FLUTTER_ENGINE env variable and so flutter was able to detect the engine directory automatically.
Still, there were many problems to solve; I had to download this four files because they were missing from the engine (the build hadn't generated them):
non-xmls.zip

which I was able to download from https://storage.googleapis.com/download.flutter.io (a url which was quite hidden in the flutter.gradle file btw, and the versions of both sources armeabi_v7a_profile and flutter_embedding_profile had to match, otherwise the app wouldn't build and it would throw no error informing about the version mismatch). However, there were still two files missing, of the form maven-metadata.xml, which weren't available at https://storage.googleapis.com/download.flutter.io. After some research, I found some urls that looked realiable and real, from maven and jcenter (which is no longer up) such as https://dl.google.com/dl/android/maven2/io/flutter , https://repo.maven.apache.org/maven2/io/flutter , https://storage.googleapis.com/download.flutter.io/ (all of them followed by flutter_embedding_profile/maven-metadata.xml or armeabi_v7a_profile/maven-metadata.xml). Literally none of them worked; in the end, I had to copy a template from the first maven-metadata.xml that I could find (I chose https://repo.maven.apache.org/maven2/io/accumulatenetwork/accumulate-java-sdk/maven-metadata.xml), create the flutter_embedding_profile-maven-metadata.xml and armeabi_v7a_profile-maven-metadata.xml files, paste the templates, change the plugin names and match the versions with the actual ones (1.0.0- I recall) and then place those files where they belonged in the engine. Here are those .xml files, if someone ever needs them (just replace the version number and hash with the ones of the sources that you downloaded from https://storage.googleapis.com/download.flutter.io):
xmls.zip

It finally compiled, and to my surprise:
specifying a dependency_overrides for sky_engine did absolutely nothing!!!
I could remove the dependency_overrides and everything did just the same thing. I don't know if this is a bug with flutter on Windows, but it has been nerve-racking and pretty weird.
The problem now is that, even though the app compiles (through the command flutter run -dR5CNA04LX6K --profile --local-engine android_profile) it throws the following error just after opening on the device (and then closes immediately):
F/flutter (19820): [FATAL:flutter/runtime/dart_vm_initializer.cc(89)] Error while initializing the Dart VM: Wrong full snapshot version, expected 'a10337a88d797e50a074855826cd53a3' found '648931f1cf135c77792cb316683ff3fc'
I have tried all possible solutions I have found to solve it, however most of them imply upgrading flutter (which we cannot do, as it is a custom framework). I have tried running flutter pub cache clean, flutter clean, git clean -xffd, deleting flutter/bin/cache and reinstalling the sdk, followed this guide: https://github.com/mildsunrise/darter/blob/master/info/versions.md
and I have just found a file C:\Apps\engine\src\out\android_profile\gen\third_party\dart\runtime\version.cc where the 648931f1cf135c77792cb316683ff3fc snapshot hash is mentioned, but nothing else. I have also tried replacing that hash with the expected one (a10337a88d797e50a074855826cd53a3) and reinstalled the custom framework, but no success. If you know anything on how to solve this, please let me know. Again, thank you so much for your attention and support. It truly encourages me to keep working on this :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 10, 2023

I had to download this four files because they were missing from the engine (the build hadn't generated them):

I am not sure whether that's the correct way... IIRC, they were auto downloaded.

Error while initializing the Dart VM: Wrong full snapshot version, expected 'a10337a88d797e50a074855826cd53a3' found '648931f1cf135c77792cb316683ff3fc'

I guess it is because your downloaded file? Dart is sensitive to versions, e.g. if you download a file built with Dart version A, while you are using Dart version B, it errors.

@jmquilez
Copy link

Hi again! I have no idea why, but in my case they are not downloaded automatically. Pretty weird. Could you confirm that on macOS (in your case) the files (under the path engine/src/out/) armeabi_v7a_profile.jar, armeabi_v7a_profile.maven-metadata.xml, armeabi_v7a_profile.pom, flutter_embedding_profile.pom, flutter_embedding_profile.jar and flutter_embedding_profile.maven-metadata.xml (in their profile, debug or release versions) are automatically downloaded?

I guess it is because your downloaded file? Dart is sensitive to versions, e.g. if you download a file built with Dart version A, while you are using Dart version B, it errors.

I tried with other versions of those files (also downloaded from https://storage.googleapis.com/download.flutter.io) and no difference, still the same error. However, I followed this guide https://github.com/mildsunrise/darter/blob/master/info/versions.md to find the dart sdk kernel snapshot version and effectively the sdk snapshot version of the custom engine is 648931f1cf135c77792cb316683ff3fc. I then did it for the custom flutter framework but did not get a10337a88d797e50a074855826cd53a3, I don't know where this hash is coming from (I also tried to run the app with other versions of the custom framework and still got the same hashes in the error message, I believe it is something mostly related to the engine).

On the other hand, I just saw that adding the flag --no-prebuilt-dart-sdk it is possible to modify the dart sdk downloaded by gclient sync (in our case, corresponding to the kernel snapshot with hash 648931f1cf135c77792cb316683ff3fc) and then maybe be able to match the new dart sdk with the kernel snapshot required. I'm going to try with other commits of the custom framework and engine and will post updates on the results.

Btw, I am able to successfully run the app with the custom engine and framework on Windows. It is utterly impossible on Android (this is what I'm currently trying).

Anyway, if you have any idea on how to approach the issue, please let me know. Again, thanks for your help and support :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 11, 2023

Hmm I have no idea. Another way may be to migrate this branch into latest flutter master, since google's infra may be unhappy about the old code? I have not been working on this for a while, so cannot verify that auto-download thing (my environment is already switched to other branches near flutter master and they work well)

@jmquilez
Copy link

jmquilez commented Jul 13, 2023

Hi again! The migration seems like a good idea. I have also been able to build the custom engine for arm64 on android, however at the time of running I get the error This version of %1 is not compatible with the version of Windows you're running., which I believe might be related to the fact that the command flutter doctor throws Windows Version (Unable to confirm if installed Windows version is 10 or greater); somehow the custom flutter framework thinks my windows installation is 32 bits (and I cannot build an arm64 app, although my Windows is actually 64 bits)? (I've checked gradle.properties file (https://stackoverflow.com/questions/75276331/flutter-blue-plus-this-version-of-1-is-not-compatible-with-the-version-of?rq=2) but no issues found). This is pretty weird, if you have any idea about it please let me know.

On the other hand, after doing a little bit of research I have been able to do some reverse engineering on the flutter app I'm trying to run with the custom build. After opening the apk and inspecting the "libflutter.so" file, I found that the app is using the dart 3.1.0-54.dev sdk version, which has absolutely nothing to do with the custom flutter framework nor any other dart sdk versions I have installed in my machine. Precisely, dart 3.1.0-54.dev yielded the snapshot hash a10337a88d797e50a074855826cd53a3 that appeared in the logs I mentioned in the previous messages. At first I related it to the fact that the engine is arm and not arm64 (and my android device is arm64, aka armeabi-v8a code, all the other flutter apps that I have built without a custom build are arm64 too), but then I saw that arm64 devices are also able to run arm (aka armeabi-v7a code), so I guess the problem is not related with the arm version (please let me know your opinion); anyway, I decided to give it a try (but got the Windows version incompatibility that I mentioned in the previous paragraph).

It seems as if flutter had picked that dart sdk version randomly, it makes no sense; the custom flutter framework dart sdk I have is 2.19 dev, as I said 3.1.0-54.dev is not related at all with anything I have installed on my computer. Extremely weird, please tell me if you know anything about this.

Btw, would it be possible to do the branch migration for both the engine and the custom framework?

Thanks for your help and amazing work.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 13, 2023

Ah again it looks like Flutter infra problem (as I said above, maybe they only support latest version?)

Btw, would it be possible to do the branch migration for both the engine and the custom framework?

I am not very sure. Flutter code is changing really rapidly! But you can have a try :)

@jmquilez
Copy link

Hi again! Thanks, could you give me a hint on how to do the migration? I'm not really sure how to go about it

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 14, 2023

Just try to merge flutter's master branch into my branch. However, I guess that can be time consuming. So before starting, I have to make some warning:

  • Flutter may have done internal changes during these months which breaks my code, making migration impossible
  • If you migrated successfully, you should still not use this custom flutter engine in any production-level app, because even Flutter master branch is not suitable for production, let alone making changes on it
  • The library is also production ready and has rough edges - since even the modified engine is super non-ready-for-production

However, if you successfully migrated, I would like to hear your benchmark results! Because theoretically my solution should yield full-FPS smooth result IMHO, so I am happy to know more experimental results.

@jmquilez
Copy link

Thanks! I will give it a try. I am also going to try to build it on macos (I dont have that much storage left on that machine, but enough to build the engine) and will post an update if it works. I really hope it does.
Btw, do you know when flutter-smooth will be available on the official flutter (in months, years, etc)? I can't wait to be able to use it in production apps!
Thanks again for your help

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 14, 2023

You are welcome, and looking forward to your results!

Btw, do you know when flutter-smooth will be available on the official flutter (in months, years, etc)? I can't wait to be able to use it in production apps!

To be honest, it cannot be determined by me. This repository already shows code that yields smooth results (all theoreical and experimental results are in the doc), but in order to make it production ready, all engine PRs have to be merged into official Flutter. That is really hard. IMHO, Flutter Googlers are very very careful about making nontrivial changes to the engine. I can totally understand them, because they have to ensure e.g. it is compatible with every existing cases, can be extended in the future, etc. However, that makes it not very easy to make PRs necessary for this repo to be merged.

@jmquilez
Copy link

jmquilez commented Jul 14, 2023

Hi again! I was finally able to build and run an app with the custom engine and framework build; using MacOS did the trick, I only had to add the forceDirectlyCallNextVsyncTargetTime parameter to two scheduleFrame functions in the custom framework (flutter/packages/flutter_test/lib/src/window.dart, lines 413 and 874) and I was then able to compile and run the app flawlessly (with some warnings, but I guess not a big deal). I then checked the apk's libflutter.so file and found that the app was precisely using the custom engine's dart sdk (2.19.something.dev), unlike the app on Windows which had chosen an apparently random dart sdk which didn't match the custom framework nor the custome engine's sdk.
Anyways, I barely cannot believe I was able to build it on MacOS in just a few hours! Windows is wicked for these kinds of things. Two years ago I had to build mongodb c++ drivers, and it took me two entire weeks on Windows but just an afternoon on Linux.
I am going to try the custom build with an app I am currently working on (mainly a video feed, social media-like) and will share the results with you. Long ago I noticed there was some micro jank (visually observable) at the time of scrolling (only sometimes, not always) and I can confirm it is not related to rasterization, as I made a few tests where I scrolled until 10k frames were rendered in total and got barely a few raster janky frames (less than ten and quite separated, which shouldn't even be observable). I also made plots of them.
I will run a few tests on the app and post the results, probably I'll also post the code of the video feed in case you'd be willing to give it a try. I believe rendering and autoplaying videos on a listview is one of the most demanding tasks for flutter when it comes to a smooth ui, and definitely being able to achieve a consistent result on that with this awesome package would be a turning point in flutter.
Again, thank you so much for your help, interest and awesome work on this project :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 14, 2023

Wow great! I have known windows can have some trouble and macos is eaiser since it is more *NIX-like, but do not know it can be this hard. Looking forward to your results!

By the way, I did not have videos (SurfaceView/TextureView?) in mind when developing this - I was thinking about widget trees (the common case). Then I am more curious about the experimental results - these native views are very special, will Smooth work on them?

@jmquilez
Copy link

jmquilez commented Jul 23, 2023

Hi again! Sorry for being inactive all these past few days, unfortunately I've been sick and was not able to work too much on this. I have built an example app with two video list views that shows them side by side: the first one plain, the other one smooth. One issue I have observed is that after scrolling the smooth listview for a few seconds, the app often crashes (though it doesn't close). I believe it'd also be worth looking a little bit into this.
Anyway, the app uses the betterplayer video player library, https://pub.dev/packages/better_player, which is (as stated by its creator) optimized for listview usage. However, when trying out the app you'll see that just after each video is loaded, the scrolling animation stutters/janks a bit, causing a visual "jumping" effect which makes the app look not too professional. If you remove the autoplay and the controls from the video, the issue might improve a little bit but the jank is still there. I have checked for ui and raster thread janks and none of them have shown enough janky frames to cause these "jumps"; sometimes they show less than 10 janky frames in more than 10000 frames total, so I guess it is not a ui nor a raster issue.
On the other hand, if you try with the smooth version of the listview, you'll see that the problem might improve a little bit too, but it doesn't solve it completely. I don't know what problem exactly loading a video has, since it is nothing ui nor raster related, but it is pretty annoying; I have not seen a single example of a smooth video listview in flutter on the Internet, and I have been searching for it for a really long time.
Here is the zipped example app (was built on Mac with smooth-flutter, in profile mode and for android):

insta_feed.zip

(Just in case for anybody else interested in trying it out, the local path route for libraries is /Users/user/, change it to your local installation of sky_engine and flutter smooth)

Thank you very much again for your help and support, and I hope we're able to find a solution to this since nobody on the Internet has seemingly been able to fix it.

PD: I won't be able to use a computer for the next 12-14 days since I'm going on holiday, although I think I'll be able to answer questions from my phone that do not require direct programming

Thanks again :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jul 23, 2023

Sorry to hear that you are sick, and I do hope you are getting well!

after scrolling the smooth listview for a few seconds, the app often crashes

Hacking engine is like that... My code is experimental and only test on devices I own, since my PRs are not merged to flutter yet. When they are getting merged, the code will be run on Flutter's CI, which covers a ton of devices and edge cases, and thus it should be much much more stable, at least will not crash like this. In addition, I have not had platform native views in my mind when designing this lib (since I personally do not use them, and when I go through the journey of solving the task nobody pointed me out about this).

so I guess it is not a ui nor a raster issue

If it is not a build/layout jank, then as is stated in this repo, flutter_smooth will not help to be smoother. The build/layout jank is a very common source of jank (see the doc), but is definitely not the only one.

For your case, I guess you can firstly use the stable Flutter channel to check a bit more about the jank problem. If both UI and raster thread is happy, but it is jank, maybe create an issue at Flutter repo? Without details, I guess it is something related to how native views are rendered together with flutter views. For example, is the platform thread (the Android main thread) somehow stuck?

You may also need a native Android profiler (in Android Studio) to check what's going on.

In addition, the devtool ui is sometimes misleading. For example, I have personally seen that (though not your case), if you run toImage() for heavy resources, the frame claims it is under 16ms and thus "smooth", but the toImage blocks the thread for a long time and you do see jank.

Thanks again :)

You are welcome! And have a nice holiday :)

@jmquilez
Copy link

Sorry to hear that you are sick, and I do hope you are getting well!

Thanks, I am recovering a bit slowly but getting better over time :).

In addition, I have not had platform native views in my mind when designing this lib

I understand, usually there are few use cases of them.

If both UI and raster thread is happy, but it is jank, maybe create an issue at Flutter repo?

Yes, I guess I'll do it when I'm back from vacation. Thanks for the suggestion :).

Without details, I guess it is something related to how native views are rendered together with flutter views. For example, is the platform thread (the Android main thread) somehow stuck?

It definitely seems like it is something related with how native views are handled by flutter, as you say. When I tried to modify the video player's library native layer (in kotlin), I removed the exoPlayer?.prepare() line and then it worked much better, it looks like maybe rendering the first frame of the video or something is creating the jank.
Also, thanks for the Android profiler suggestion, I had omitted it completely.

In addition, the devtool ui is sometimes misleading

I noticed after a few tests, it often doesn't yield accurate results.

For example, I have personally seen that (though not your case), if you run toImage() for heavy resources, the frame claims it is under 16ms and thus "smooth", but the toImage blocks the thread for a long time and you do see jank

Wow, that is surely something the flutter team should look into. A bit upsetting they don't cover these kind of cases.

You are welcome! And have a nice holiday :)

Thanks so much! I'll notify when I'm back. Have a nice rest of the day!

@jmquilez
Copy link

Hi again! After a few days, I finally opened the promised issue at the official flutter repo: flutter/flutter#132675

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 16, 2023

@jmquilez Btw, how is the result of Android profiler, eg the one in Android Studio? Does it show any janks that matches your visual observations?

@jmquilez
Copy link

jmquilez commented Aug 20, 2023

Hey again @fzyzcjy! Sorry for not answering earlier. As for the profiler results, I have been testing the app and it looks like the android performance view shows janky frames that actually match what I see on the app, unlike the dart devtools performance view. However, at the time of using the android profiler, following this guide: https://developer.android.com/studio/profile/jank-detection?hl=es-419 and after recording a system trace, the Frames section inside the Display section of the trace shows no frames that I can inspect, as if the trace was not recording the frames themselves. Here's a picture of it (mine doesn't have a Janky frames section, I believe because of the Android Studio Version):

Captura de pantalla 2023-08-20 a las 18 45 40

I have tried updating my Android Studio installation (I had Arctic Fox, now it's Giraffe, the latest version) and still, I get no information at the Frames section. It is as if Android Studio had predicted my intentions, since all the other sections show the proper information except for the Frames one :/.
I am currently in the process trying to fix the issue by running a different project (non-flutter) to see if there is any difference. If you have any idea of why it is not working please let me know, there is surprisingly quite little information about frame profiling in Android Studio apart from the official documentation. I'll post an update when I manage to solve the problem (shortly, I hope). Thanks so much for your support :).

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 21, 2023

it looks like the android performance view shows janky frames that actually match what I see on the app

Looks great!

er recording a system trace, the Frames section inside the Display section of the trace shows no frames that I can inspect, as if the trace was not recording the frames themselves

I also sometimes see profiling results are incomplete... So some possibilities may be:

  • create an issue at android studio reporting this bug
  • try another phone (eg different android versions can cause the problem, which I saw earlier)

Or, maybe Flutter does not yield Frames that android studio can understand?

You are welcome!

@jmquilez
Copy link

jmquilez commented Aug 21, 2023

Hi @fzyzcjy indeed it seems to be the last reason you provided

Or, maybe Flutter does not yield Frames that android studio can understand?

I have profiled both a react native app and a native android app on Android Studio and in both cases the Display section shows a Janky frames section that transforms into an All frames section if the all frames checkbox is selected, as shown in the pictures below:

  1. React native:
react-native
  1. Android native:
android-native

And for flutter it's the same picture I provided yesterday. I have also tried running the app on a different device (Samsung A51, with Android 10) and instead of nothing it shows a horizontal grey bar in the Frames section, but still no frames. Here's a picture of it:

a51

It also seems weird to me that the Display section itself has different sections in it depending on whether the app is built with flutter or not, as it can be seen in the picture (usually it only has one section, but in the flutter case it has four).

create an issue at android studio reporting this bug

I have seen Android Studio does not have an official GitHub repo, do you know where I could contact the developers or anybody that knows what is precisely going on here? Although it doesn't look like a bug itself, but like a programmed behavior towards flutter apps. Still, if it is not possible to profile frames from Android Studio, as far as I know the only thing that's left is the Flutter Performance View, which works like trash; it's quite upsetting that the only tool they provide for this purpose is so buggy; how do they even expect developers to release decent apps if their performance can't even be tested properly?. If you know any other tools I could use for this please let me know.

Again, thanks so much for your attention and help, I truly appreciate it :).

@jmquilez
Copy link

Update:
I've come across this flutter issue: flutter/flutter#127276 where the author seems to have just the same problem as we do; the android studio performance chart showing the right janky frames but the flutter devtools showing no jank.

it looks like the android performance view shows janky frames that actually match what I see on the app

I forgot to attach a picture about this, here it is:

janky

This is basically the same as @matthew_carroll mentioned here: flutter/flutter#127276 (comment), and from what I've read so far this problem might be related to latency. I'm going to continue reading that issue and might comment this particular case there, in case they are interested in testing it and confirming it is all related to the same problem. Still, without being able to see frame data from Android Studio (as shown in the picture above) it is quite uncertain to determine the actual cause of the jank.

@jmquilez
Copy link

Just commented on the issue, seems like they are open to discuss new ways to measure jank on the devtools flutter/flutter#127276 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants