Getting "call to UsageTracker before initialization" when running :buildSearchableOptions
Answered
I'm developing an IDEA plugin for Android Studio, but every time I run :buildSearchableOptions or :buildPlugin, the following errors occurred:
+0800 [ERROR] [system.err] java.lang.RuntimeException: call to UsageTracker before initialization
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.android.tools.analytics.UsageTracker.ensureInitialized(UsageTracker.kt:160)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.android.tools.analytics.UsageTracker.runIfUsageTrackerUsable(UsageTracker.kt:123)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.android.tools.analytics.UsageTracker.log(UsageTracker.kt:142)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.android.tools.idea.updater.configure.SdkUpdaterConfigPanel.<init>(SdkUpdaterConfigPanel.java:246)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.android.tools.idea.updater.configure.SdkUpdaterConfigurable.createComponent(SdkUpdaterConfigurable.java:132)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.intellij.openapi.options.ex.ConfigurableWrapper.createComponent(ConfigurableWrapper.java:172)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.intellij.ide.ui.search.SearchUtil.processConfigurables(SearchUtil.java:82)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.intellij.ide.ui.search.SearchUtil.processProjectConfigurables(SearchUtil.java:52)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.intellij.ide.ui.search.TraverseUIStarter.startup(TraverseUIStarter.java:100)
2021-08-09T13:44:43.961+0800 [ERROR] [system.err] at com.intellij.ide.ui.search.TraverseUIStarter.main(TraverseUIStarter.java:83)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.idea.ApplicationLoader$startApp$8$1$1.run(ApplicationLoader.kt:245)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.idea.ApplicationLoader$startApp$8$1.run(ApplicationLoader.kt:244)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:216)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:24)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:199)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:828)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:330)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:85)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:134)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:190)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
2021-08-09T13:44:43.962+0800 [ERROR] [system.err] at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.base/java.security.AccessController.doPrivileged(Native Method)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:976)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:843)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:454)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:773)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:453)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:828)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:501)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
2021-08-09T13:44:43.963+0800 [ERROR] [system.err] at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
2021-08-09T13:44:43.964+0800 [ERROR] [system.err] at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Please sign in to leave a comment.
It's hard to guess why it fails on AS. However, it would help if you double-checked your implementation of the Configurable.
It's not failed on AS, It failed when I run `:buildSearchableOption` and `:buildPlugin`.
Same issue for me. It works with runIde, but not buildPlugin.
Looks like the exception is thrown from here: https://android.googlesource.com/platform/tools/analytics-library/+/refs/heads/studio-master-dev/tracker/src/main/java/com/android/tools/analytics/UsageTracker.kt#159.
Here is a workaround that makes the build succeed at least:
Not sure if that messes up something else though.
https://issuetracker.google.com/issues/194525628