AndroidStudio Kotlin Analysis 卡住

2021-12-21  本文已影响0人  笨鱼天阳

Android Studio

原文:https://blog.csdn.net/CrazyApes/article/details/122043395

前言

最近更新完 Android Studio 之后,发现莫名其妙的经常很卡。通过任务管理器查看Studio竟然一直持续CPU使用率在95%以上, What the Fk!!

什么情况啊!

首先确认,当前Studio没有运行下载,没有打包,没有开模拟器,也没什么正在执行的任务。
最后找了半天发现 Analysis.. 在持续运行。。。
很疯狂的运行。。。

repeat.gif

Android Studio 版本

Android Studio.png

Android Studio Arctic Fox | 2020.3.1 Patch 3
Build #AI-203.7717.56.2031.7784292, built on October 1, 2021
Runtime version: 11.0.10+0-b96-7249189 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: GsonFormatPlus, Dart, org.jetbrains.kotlin, io.flutter

Log

目测肯定是有问题啊。
咱们先找Log日志看看。

错误日志如下


2021-12-20 14:45:41,225 [ 324567]  ERROR - aemon.impl.PassExecutorService - Android Studio Arctic Fox | 2020.3.1 Patch 3  Build #AI-203.7717.56.2031.7784292 
2021-12-20 14:45:41,225 [ 324567]  ERROR - aemon.impl.PassExecutorService - JDK: 11.0.10; VM: OpenJDK 64-Bit Server VM; Vendor: Oracle Corporation 
2021-12-20 14:45:41,225 [ 324567]  ERROR - aemon.impl.PassExecutorService - OS: Windows 10 
2021-12-20 14:45:41,226 [ 324568]  ERROR - aemon.impl.PassExecutorService - Plugin to blame: Kotlin version: 203-1.6.10-release-923-AS7717.8 
2021-12-20 14:45:41,227 [ 324569]  ERROR - aemon.impl.PassExecutorService - Last Action: EditorEnter 
2021-12-20 14:45:42,160 [ 325502]  ERROR - aemon.impl.PassExecutorService - ContentElementType: ManifestFile; file: ManifestFile:MANIFEST.MF
    Boolean.TRUE.equals(getUserData(BUILDING_STUB)) = false
    getTreeElement() = Element(ManifestFile)
    vFile instanceof VirtualFileWithId = true
    StubUpdatingIndex.canHaveStub(vFile) = false 
java.lang.AssertionError: ContentElementType: ManifestFile; file: ManifestFile:MANIFEST.MF
    Boolean.TRUE.equals(getUserData(BUILDING_STUB)) = false
    getTreeElement() = Element(ManifestFile)
    vFile instanceof VirtualFileWithId = true
    StubUpdatingIndex.canHaveStub(vFile) = false
    at com.intellij.psi.impl.source.PsiFileImpl.calcStubTree(PsiFileImpl.java:976)
    at com.intellij.psi.stubs.StubProcessingHelperBase.checkType(StubProcessingHelperBase.java:91)
    at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:61)
    at com.intellij.psi.stubs.StubIndexImpl.lambda$processElements$2(StubIndexImpl.java:291)
    at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:327)
    at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:105)
    at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:93)
    at org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeClassByPackageIndex.get(KotlinFileFacadeClassByPackageIndex.kt:19)
    at org.jetbrains.kotlin.idea.caches.resolve.IDEKotlinAsJavaSupport$getFacadeClassesInPackage$facadeFilesInPackage$1.invoke(IDEKotlinAsJavaSupport.kt:55)
    at org.jetbrains.kotlin.idea.caches.resolve.IDEKotlinAsJavaSupport$getFacadeClassesInPackage$facadeFilesInPackage$1.invoke(IDEKotlinAsJavaSupport.kt:53)
    at org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt.runReadAction$lambda-0(ApplicationUtils.kt:17)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:877)
    at org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt.runReadAction(ApplicationUtils.kt:17)
    at org.jetbrains.kotlin.idea.caches.resolve.IDEKotlinAsJavaSupport.getFacadeClassesInPackage(IDEKotlinAsJavaSupport.kt:53)
    at org.jetbrains.kotlin.asJava.LightClassUtilsKt.findFacadeClass(lightClassUtils.kt:58)
    at org.jetbrains.uast.kotlin.KotlinInternalUastUtilsKt.getContainingLightClass(kotlinInternalUastUtils.kt:89)
    at org.jetbrains.uast.kotlin.KotlinConverter.getLightClassForFakeMethod(KotlinConverter.kt:479)
    at org.jetbrains.uast.kotlin.KotlinConverter.convertDeclaration(KotlinConverter.kt:428)
    at org.jetbrains.uast.kotlin.KotlinConverter.convertDeclarationOrElement(KotlinConverter.kt:488)
    at org.jetbrains.uast.kotlin.KotlinUastLanguagePlugin.convertElementWithParent(KotlinUastLanguagePlugin.kt:67)
    at org.jetbrains.uast.UastFacade.convertElementWithParent(UastContext.kt:68)
    at org.jetbrains.uast.UastContextKt.toUElement(UastContext.kt:111)
    at com.intellij.codeInspection.apiUsage.ApiUsageUastVisitor.visitSimpleNameReferenceExpression(ApiUsageUastVisitor.kt:80)
    at org.jetbrains.uast.kotlin.KotlinUSimpleReferenceExpression.accept(KotlinUSimpleReferenceExpression.kt:47)
    at com.intellij.uast.UastVisitorAdapter.visitElement(UastVisitorAdapter.java:48)
    at org.jetbrains.kotlin.psi.KtElementImpl.accept(KtElementImpl.java:54)
    at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:66)
    at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:57)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:311)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$4(LocalInspectionsPass.java:270)
    at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:156)
    at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:148)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$5(LocalInspectionsPass.java:268)
    at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:127)
    at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:116)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$6(LocalInspectionsPass.java:268)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1146)
    at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
    at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
    at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:172)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:189)
    at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
    at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)


解决办法

注:下载地址为谷歌中文开发者社区,非营销,非推广!

个人尝试

由于我是kotlin升级和 Invalidate Caches/Restart 同时做的,不太确定哪个具体生效的。
个人倾向是后者,错误原因可能还是插件的问题。

其它

日志错误尚未分析。
有相关经验的大佬可以在评论区指导一下。

参考文献

https://stackoverflow.com/questions/68113077/how-to-resume-a-stuck-code-analysis-in-android-studio
https://stackoverflow.com/questions/64984549/android-studio-stuck-at-analyzing

Android Studio Download

Android Studio 常见问题

上一篇下一篇

猜你喜欢

热点阅读