Android studio sync measurement fails in 2nd build
See original GitHub issueWe have a scenario file:
studio_sync {
android-studio-sync {
}
}
That we run with following command:
gradle-profiler --scenario-file scenarios.txt studio_sync --benchmark --studio-install-dir <install_dir>
I am running a gradle-profiler built from source (at 72fd85694fcd18b49ba2b03cda401787390374b5), as latest binary release (0.16.0) does not support Android Studio 7+ (becuse of https://github.com/gradle/gradle-profiler/pull/358).
Android Studio version used is Bumblebee 2021.1.1 Beta 4 currently in beta, but latest stable (Arctic Fox) does not work with:
Plugin 'Gradle Profiler IntelliJ/Android Studio Plugin' (version '0.17.0-alpha09') is not compatible with the current version of the IDE, because it requires build 211.0 or newer but the current build is AI-203.7717.56
More Studio info:
Build #AI-211.7628.21.2111.7905991, built on November 11, 2021 Runtime version: 11.0.11+0-b60-7590822 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 12.0.1 GC: G1 Young Generation, G1 Old Generation Memory: 3072M Cores: 16
While the same setup works with smaller project like https://github.com/material-components/material-components-android, when used on our work project, we get following output and Studio stays open doing nothing.
* Running sync in Android Studio...
* Sent sync request
* Sync has started, waiting for it to complete...
* Gradle invocation has completed in: 42783ms
* Full sync has completed in: 344462ms and it succeeded
Execution time 344462 ms
* Running warm-up build #2
* Running sync in Android Studio...
* Sent sync request
* Sync has started, waiting for it to complete...
* Stopping Android Studio....
* Android Studio stopped.
After manually closing the Studio the process fails with:
* Stopping daemons
java.lang.ClassCastException: Cannot cast org.gradle.profiler.client.protocol.messages.GradleInvocationStarted to org.gradle.profiler.client.protocol.messages.GradleInvocationCompleted
at java.base/java.lang.Class.cast(Class.java:3605)
at org.gradle.profiler.client.protocol.serialization.MessageProtocolHandler.receive(MessageProtocolHandler.java:42)
at org.gradle.profiler.client.protocol.ServerConnection.receiveGradleInvocationCompleted(ServerConnection.java:35)
at org.gradle.profiler.studio.StudioGradleClient.lambda$sync$1(StudioGradleClient.java:83)
at org.gradle.profiler.studio.process.StudioProcessController.run(StudioProcessController.java:64)
at org.gradle.profiler.studio.process.StudioProcessController.run(StudioProcessController.java:43)
at org.gradle.profiler.studio.StudioGradleClient.sync(StudioGradleClient.java:74)
at org.gradle.profiler.AndroidStudioSyncAction.run(AndroidStudioSyncAction.java:33)
at org.gradle.profiler.BuildUnderTestInvoker$InvokeAndMeasureAction.run(BuildUnderTestInvoker.java:60)
at org.gradle.profiler.BuildUnderTestInvoker$InvokeAndMeasureAction.run(BuildUnderTestInvoker.java:41)
at org.gradle.profiler.RunBuildStepAction.run(RunBuildStepAction.java:29)
at org.gradle.profiler.ScenarioInvoker.runMeasured(ScenarioInvoker.java:36)
at org.gradle.profiler.GradleScenarioInvoker.doRun(GradleScenarioInvoker.java:117)
at org.gradle.profiler.GradleScenarioInvoker.doRun(GradleScenarioInvoker.java:21)
at org.gradle.profiler.ScenarioInvoker.run(ScenarioInvoker.java:17)
at org.gradle.profiler.Main.invoke(Main.java:117)
at org.gradle.profiler.Main.run(Main.java:79)
at org.gradle.profiler.Main.main(Main.java:21)
* Results written to /Users/nagy/EgitProjects/george-app-android/profile-out-3
/Users/nagy/EgitProjects/george-app-android/profile-out-3/benchmark.csv
/Users/nagy/EgitProjects/george-app-android/profile-out-3/benchmark.html
Here I am attaching full logs from the benchmark run: profile.log idea.log
Thanks for any help and let me know if I can provide any additional info.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)

Top Related StackOverflow Question
I just tried the build from your branch and can confirm that it fixes the issue for our project and the measurement completes succesfully. Thank you for the quick fix. 👍
@ghus-raba this should be fixed with https://github.com/gradle/gradle-profiler/pull/379. Can you maybe try it with asodja/studio-buildsrc-fix branch?