question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android studio sync measurement fails in 2nd build

See original GitHub issue

We 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:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ferinagycommented, Nov 29, 2021

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. 👍

1reaction
asodjacommented, Nov 29, 2021

@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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error running android: Gradle project sync failed. Please fix ...
1. Make sure your gradle is not in offline mode, it's under Preferences/Build, Execution, Deployment/Gradle and there you will see a Offline work...
Read more >
How to fix ' Gradle Project Sync Failed in Android studio '.
Today, in this video i will show you how to fix ' Gradle Project Sync Failed in Android studio '.To fix this issue...
Read more >
Optimize your build speed | Android Developers
Long build times slow down your development process. This page provides some techniques to help resolve build speed bottlenecks.
Read more >
Android – Gradle sync fails – play-services-measurement-base
I have a problem on my Android project, I can't build, this is the error I have: Failed to notify dependency resolution listener....
Read more >
Different Ways to fix "Error running android: Gradle project ...
Method 2: Sync your project with Gradle files ... This issue will not be solved if the folder containing Gradle files is deleted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found