Plugin build fails with error "call to AnalyticsSettings before initialization"
Answered
Hi,
When I try to build my Android Studio plugin with
.\gradlew buildPlugin
it fails with the error during the task buildSearchableOptions with this error:
2022-03-09 10:36:30,246 [ 1953] ERROR - nsions.impl.ExtensionPointImpl - call to AnalyticsSettings before initialization
java.lang.RuntimeException: call to AnalyticsSettings before initialization
at com.android.tools.analytics.AnalyticsSettings.ensureInitialized(AnalyticsSettings.kt:115)
at com.android.tools.analytics.AnalyticsSettings.runIfAnalyticsSettingsUsable(AnalyticsSettings.kt:93)
at com.android.tools.analytics.AnalyticsSettings.getUserId(AnalyticsSettings.kt:66)
at com.android.tools.idea.serverflags.ServerFlagInitializerKt.isOSEnabled(ServerFlagInitializer.kt:84)
at com.android.tools.idea.serverflags.ServerFlagInitializerKt.access$isOSEnabled(ServerFlagInitializer.kt:1)
at com.android.tools.idea.serverflags.ServerFlagInitializer$Companion$initializeService$filter$1.invoke(ServerFlagInitializer.kt:65)
at com.android.tools.idea.serverflags.ServerFlagInitializer$Companion$initializeService$filter$1.invoke(ServerFlagInitializer.kt:65)
at com.android.tools.idea.serverflags.ServerFlagInitializer$Companion.initializeService(ServerFlagInitializer.kt:103)
at com.android.tools.idea.serverflags.ServerFlagInitializer$Companion.initializeService(ServerFlagInitializer.kt:41)
at com.android.tools.idea.serverflags.ServerFlagInitializer.initializeService(ServerFlagInitializer.kt)
at com.android.tools.idea.startup.AndroidStudioInitializer.customize(AndroidStudioInitializer.java:85)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.lambda$new$0(ActionManagerImpl.java:178)
at com.intellij.openapi.extensions.impl.ExtensionProcessingHelper.forEachExtensionSafe(ExtensionProcessingHelper.java:34)
at com.intellij.openapi.extensions.ExtensionPointName.forEachExtensionSafe(ExtensionPointName.java:46)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.<init>(ActionManagerImpl.java:178)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:47)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:771)
at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:49)
at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:37)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:110)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:64)
at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:488)
at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:471)
at com.intellij.openapi.actionSystem.ActionManager.getInstance(ActionManager.java:30)
at com.intellij.ui.ListSpeedSearch$MySelectAllAction.<init>(ListSpeedSearch.java:95)
at com.intellij.ui.ListSpeedSearch.registerSelectAll(ListSpeedSearch.java:35)
at com.intellij.ui.ListSpeedSearch.<init>(ListSpeedSearch.java:31)
at com.intellij.application.options.editor.GutterIconsConfigurable.createUIComponents(GutterIconsConfigurable.java:218)
at com.intellij.application.options.editor.GutterIconsConfigurable.$$$setupUI$$$(GutterIconsConfigurable.java)
at com.intellij.application.options.editor.GutterIconsConfigurable.<init>(GutterIconsConfigurable.java:48)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:722)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:781)
at com.intellij.openapi.options.ConfigurableEP$ClassProducer.createElement(ConfigurableEP.java:440)
at com.intellij.openapi.options.ConfigurableEP.createConfigurable(ConfigurableEP.java:346)
at com.intellij.openapi.options.ex.ConfigurableWrapper.createConfigurable(ConfigurableWrapper.java:42)
at com.intellij.openapi.options.ex.ConfigurableWrapper.wrapConfigurable(ConfigurableWrapper.java:36)
at com.intellij.openapi.options.ex.ConfigurableWrapper.wrapConfigurable(ConfigurableWrapper.java:24)
at com.intellij.openapi.options.ex.ConfigurableWrapper$CompositeWrapper.getConfigurables(ConfigurableWrapper.java:310)
at com.intellij.ide.actions.ShowSettingsUtilImpl.getConfigurables(ShowSettingsUtilImpl.java:71)
at com.intellij.ide.ui.search.TraverseUIStarter.lambda$startup$0(TraverseUIStarter.java:111)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:969)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:839)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:787)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2022-03-09 10:36:30,249 [ 1956] ERROR - nsions.impl.ExtensionPointImpl - Android Studio Bumblebee | 2021.1.1 Patch 2 Build #AI-211.7628.21.2111.8193401
2022-03-09 10:36:30,251 [ 1958] ERROR - nsions.impl.ExtensionPointImpl - JDK: 11.0.11; VM: OpenJDK 64-Bit Server VM; Vendor: Oracle Corporation
2022-03-09 10:36:30,251 [ 1958] ERROR - nsions.impl.ExtensionPointImpl - OS: Windows 10
2022-03-09 10:36:30,252 [ 1959] ERROR - nsions.impl.ExtensionPointImpl - Last Action:
2022-03-09 10:36:35,484 [ 7191] ERROR - j.util.ui.EdtInvocationManager - null
java.lang.reflect.InvocationTargetException
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1373)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1348)
at com.intellij.util.ui.EdtInvocationManager$SwingEdtInvocationManager.invokeAndWait(EdtInvocationManager.java:176)
at com.intellij.util.ui.EdtInvocationManager.invokeAndWaitIfNeeded(EdtInvocationManager.java:152)
at com.intellij.ide.ui.search.TraverseUIStarter.startup(TraverseUIStarter.java:106)
at com.intellij.ide.ui.search.TraverseUIStarter.main(TraverseUIStarter.java:91)
at com.intellij.idea.ApplicationLoader$startApp$8.run(ApplicationLoader.kt:237)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:783)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
Found 114 configurables
at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1085)
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.RuntimeException: call to UsageTracker before initialization
at com.android.tools.analytics.UsageTracker.ensureInitialized(UsageTracker.kt:164)
at com.android.tools.analytics.UsageTracker.runIfUsageTrackerUsable(UsageTracker.kt:127)
at com.android.tools.analytics.UsageTracker.log(UsageTracker.kt:146)
at com.android.tools.idea.updater.configure.SdkUpdaterConfigPanel.<init>(SdkUpdaterConfigPanel.java:246)
at com.android.tools.idea.updater.configure.SdkUpdaterConfigurable.createComponent(SdkUpdaterConfigurable.java:132)
at com.intellij.openapi.options.ex.ConfigurableWrapper.createComponent(ConfigurableWrapper.java:169)
at com.intellij.ide.ui.search.SearchUtil.processConfigurables(SearchUtil.java:75)
at com.intellij.ide.ui.search.TraverseUIStarter.lambda$startup$0(TraverseUIStarter.java:111)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:969)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:839)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:787)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2022-03-09 10:36:35,485 [ 7192] ERROR - j.util.ui.EdtInvocationManager - Android Studio Bumblebee | 2021.1.1 Patch 2 Build #AI-211.7628.21.2111.8193401
2022-03-09 10:36:35,485 [ 7192] ERROR - j.util.ui.EdtInvocationManager - JDK: 11.0.11; VM: OpenJDK 64-Bit Server VM; Vendor: Oracle Corporation
2022-03-09 10:36:35,485 [ 7192] ERROR - j.util.ui.EdtInvocationManager - OS: Windows 10
2022-03-09 10:36:35,486 [ 7193] ERROR - j.util.ui.EdtInvocationManager - Last Action:
Searchable options index builder failed
java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
at java.base/java.util.regex.Pattern.error(Pattern.java:2027)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1788)
at java.base/java.util.regex.Pattern.<init>(Pattern.java:1428)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1068)
at java.base/java.lang.String.replaceAll(String.java:2126)
at com.intellij.ide.ui.search.TraverseUIStarter.getModuleByPath(TraverseUIStarter.java:337)
at com.intellij.ide.ui.search.TraverseUIStarter.getModuleByClass(TraverseUIStarter.java:346)
at com.intellij.ide.ui.search.TraverseUIStarter.startup(TraverseUIStarter.java:155)
at com.intellij.ide.ui.search.TraverseUIStarter.main(TraverseUIStarter.java:91)
at com.intellij.idea.ApplicationLoader$startApp$8.run(ApplicationLoader.kt:237)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:783)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1085)
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
The only relevant related resource I found is this issue but it does not help. Any idea?
Regards
Please sign in to leave a comment.
If your plugin does not have searchable options itself, you can workaround by disabling buildSearchableOptions task completely in your Gradle script. Alternatively, could you try building against a newer version of AS?
TBC
Thanks for your answer. Yes I will disable the buildSearchableOptions task for the moment.
I still have errors with newer versions, I tried with Android Studio Chipmunk | 2021.2.1 Beta 3 :
and with Android Studio Dolphin | 2021.3.1 Canary 5 :
I'm afraid, there's no workaround for this. Checking further...
It seems both issues are coming from Android NDK Support plugin, which is maintained by Google. Please file a bug report https://developer.android.com/studio/report-bugs
Here it is: https://issuetracker.google.com/issues/224810684
Thanks for your help.