gradle/gradle-profiler

Android Studio Jellyfish Canary 2 can't load GradleProfilerStartupActivity

TadeasKriz opened this issue · 4 comments

2024-01-03 11:39:23,952 [  10103] SEVERE - #c.i.i.s.i.StartupManagerImpl - Cannot load class org.gradle.profiler.studio.plugin.GradleProfilerStartupActivity$1 (
  error: com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsListenerAdapter,
  classLoader=PluginClassLoader(plugin=PluginDescriptor(name=Gradle Profiler IntelliJ/Android Studio Plugin, id=org.gradle.profiler.studio.plugin, descriptorPath=plugin.xml, path=~/Developer/Sources/wallet/app/gradle/benchmarks/_build/profile-out/studio-sandbox/plugins/gradle-profiler-studio-plugin, version=0.20.0, package=null, isBundled=false), packagePrefix=null, state=active)
)
com.intellij.diagnostic.PluginException: Cannot load class org.gradle.profiler.studio.plugin.GradleProfilerStartupActivity$1 (
  error: com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsListenerAdapter,
  classLoader=PluginClassLoader(plugin=PluginDescriptor(name=Gradle Profiler IntelliJ/Android Studio Plugin, id=org.gradle.profiler.studio.plugin, descriptorPath=plugin.xml, path=~/Developer/Sources/wallet/app/gradle/benchmarks/_build/profile-out/studio-sandbox/plugins/gradle-profiler-studio-plugin, version=0.20.0, package=null, isBundled=false), packagePrefix=null, state=active)
)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.kt:331)
	at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.kt:178)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.kt:151)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	at org.gradle.profiler.studio.plugin.GradleProfilerStartupActivity.disableDownloadOfExternalAnnotations(GradleProfilerStartupActivity.java:60)
	at org.gradle.profiler.studio.plugin.GradleProfilerStartupActivity.runActivity(GradleProfilerStartupActivity.java:43)
	at com.intellij.ide.startup.impl.StartupManagerImpl.runOldActivity(StartupManagerImpl.kt:328)
	at com.intellij.ide.startup.impl.StartupManagerImpl.access$runOldActivity(StartupManagerImpl.kt:69)
	at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$5$1.invoke(StartupManagerImpl.kt:271)
	at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$5$1.invoke(StartupManagerImpl.kt:270)
	at com.intellij.openapi.progress.CoroutinesKt.blockingContextInner(coroutines.kt:321)
	at com.intellij.openapi.progress.CoroutinesKt.access$blockingContextInner(coroutines.kt:1)
	at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invokeSuspend(coroutines.kt:198)
	at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invoke(coroutines.kt)
	at com.intellij.openapi.progress.CoroutinesKt$blockingContext$2.invoke(coroutines.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
	at com.intellij.openapi.progress.CoroutinesKt.blockingContext(coroutines.kt:197)
	at com.intellij.ide.startup.impl.StartupManagerImpl.runPostStartupActivities(StartupManagerImpl.kt:270)
	at com.intellij.ide.startup.impl.StartupManagerImpl.access$runPostStartupActivities(StartupManagerImpl.kt:69)
	at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3$2.invokeSuspend(StartupManagerImpl.kt:192)
	at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3$2.invoke(StartupManagerImpl.kt)
	at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3$2.invoke(StartupManagerImpl.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
	at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3.invokeSuspend(StartupManagerImpl.kt:191)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: java.lang.NoClassDefFoundError: com/intellij/openapi/externalSystem/settings/ExternalSystemSettingsListenerAdapter
	at java.base/java.lang.ClassLoader.defineClass2(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
	at com.intellij.util.lang.UrlClassLoader.consumeClassData(UrlClassLoader.java:289)
	at com.intellij.util.lang.ZipResourceFile.findClass(ZipResourceFile.java:113)
	at com.intellij.util.lang.JarLoader.findClass(JarLoader.java:58)
	at com.intellij.util.lang.ClassPath.findClassInLoader(ClassPath.java:240)
	at com.intellij.util.lang.ClassPath.findClass(ClassPath.java:190)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.kt:326)
	... 32 more
Caused by: java.lang.ClassNotFoundException: com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter PluginClassLoader(plugin=PluginDescriptor(name=Gradle Profiler IntelliJ/Android Studio Plugin, id=org.gradle.profiler.studio.plugin, descriptorPath=plugin.xml, path=~/Developer/Sources/wallet/app/gradle/benchmarks/_build/profile-out/studio-sandbox/plugins/gradle-profiler-studio-plugin, version=0.20.0, package=null, isBundled=false), packagePrefix=null, state=active)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.kt:156)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	... 40 more

Seems like a class that was previously available com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter is no longer present.

asodja commented

Thanks for the report! Gradle-profiler is not tested with Android Studio Jellyfish yet.

This is a valid issue.

I'm also unable to use profiler with Jellyfish (canary04). I built gradle-profiler from master and get this error:

java.lang.IllegalStateException: Timeout waiting for incoming connection from start-detector.
	at org.gradle.profiler.studio.process.StudioProcess.waitOnSuccessfulIdeStart(StudioProcess.java:53)
	at org.gradle.profiler.studio.process.StudioProcess.<init>(StudioProcess.java:37)
	at org.gradle.profiler.studio.process.StudioProcessController.maybeStartProcess(StudioProcessController.java:76)
	at org.gradle.profiler.studio.process.StudioProcessController.run(StudioProcessController.java:43)
	at org.gradle.profiler.studio.StudioGradleClient.sync(StudioGradleClient.java:78)
	at org.gradle.profiler.studio.AndroidStudioSyncAction.run(AndroidStudioSyncAction.java:36)
	at org.gradle.profiler.gradle.BuildUnderTestInvoker$InvokeAndMeasureAction.run(BuildUnderTestInvoker.java:71)
	at org.gradle.profiler.gradle.BuildUnderTestInvoker$InvokeAndMeasureAction.run(BuildUnderTestInvoker.java:51)
	at org.gradle.profiler.RunBuildStepAction.run(RunBuildStepAction.java:29)
	at org.gradle.profiler.ScenarioInvoker.runMeasured(ScenarioInvoker.java:28)
	at org.gradle.profiler.gradle.GradleScenarioInvoker.run(GradleScenarioInvoker.java:121)
	at org.gradle.profiler.studio.invoker.StudioGradleScenarioInvoker.run(StudioGradleScenarioInvoker.java:63)
	at org.gradle.profiler.studio.invoker.StudioGradleScenarioInvoker.run(StudioGradleScenarioInvoker.java:19)
	at org.gradle.profiler.Main.invoke(Main.java:138)
	at org.gradle.profiler.Main.run(Main.java:96)
	at org.gradle.profiler.Main.main(Main.java:35)
Caused by: java.lang.IllegalStateException: Timeout waiting for incoming connection from start-detector.
	at org.gradle.profiler.client.protocol.Server.waitForIncoming(Server.java:50)
	at org.gradle.profiler.studio.process.StudioProcess.waitOnSuccessfulIdeStart(StudioProcess.java:46)
	... 15 more

Android studio is started, but profiler seems unable to attach to it and start a sync

gavra0 commented

This is because of JetBrains/intellij-community@d33ec90, that removed ExternalSystemSettingsListenerAdapter. This code should be migrated to use GradleSettingsListener.

I got it working with Jellyfish: #532