Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.jetbrains.kotlin.util.KotlinFrontEndException:

Tags:

android

kotlin

Error: org.jetbrains.kotlin.util.KotlinFrontEndException: Front-end Internal error: Failed to analyze declaration

Cause: kotlin.KotlinNullPointerException

After android studio update , not possible to run projects. how to fix this error? Used android studio version is 3.3 and kotlin-stdlib version is 1.3.0. is it kotlin version bug or android studio bug?

 org.jetbrains.kotlin.util.KotlinFrontEndException: Front-end Internal error: Failed to analyze declaration
Cause: kotlin.KotlinNullPointerException
File being compiled at position: (48,1) in /CountrySelectActivity.kt
The root cause was thrown at: KtQualifiedExpression.kt:35
at org.jetbrains.kotlin.resolve.ExceptionWrappingKtVisitorVoid.visitDeclaration(ExceptionWrappingKtVisitorVoid.kt:43)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitDeclaration(KtVisitorVoid.java:453)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitDeclaration(KtVisitorVoid.java:21)
at org.jetbrains.kotlin.psi.KtVisitor.visitNamedDeclaration(KtVisitor.java:398)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitNamedDeclaration(KtVisitorVoid.java:381)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitNamedDeclaration(KtVisitorVoid.java:959)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitNamedDeclaration(KtVisitorVoid.java:21)
at org.jetbrains.kotlin.psi.KtVisitor.visitClassOrObject(KtVisitor.java:41)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitClassOrObject(KtVisitorVoid.java:37)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitClassOrObject(KtVisitorVoid.java:465)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitClassOrObject(KtVisitorVoid.java:21)
at org.jetbrains.kotlin.psi.KtVisitor.visitClass(KtVisitor.java:33)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitClass(KtVisitorVoid.java:33)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitClass(KtVisitorVoid.java:459)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitClass(KtVisitorVoid.java:21)
at org.jetbrains.kotlin.psi.KtClass.accept(KtClass.kt:34)
at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:59)
at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer$analyzeDeclarations$1.registerDeclarations(LazyTopDownAnalyzer.kt:78)
at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer$analyzeDeclarations$1.visitKtFile(LazyTopDownAnalyzer.kt:96)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:513)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:21)
at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:221)
at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:208)
at org.jetbrains.kotlin.resolve.ExceptionWrappingKtVisitorVoid.visitElement(ExceptionWrappingKtVisitorVoid.kt:27)
at org.jetbrains.kotlin.com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
at org.jetbrains.kotlin.psi.KtVisitor.visitKtFile(KtVisitor.java:73)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:69)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:513)
at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:21)
at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:221)
at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:208)
at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations(LazyTopDownAnalyzer.kt:201)
at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations$default(LazyTopDownAnalyzer.kt:60)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:110)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:82)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:375)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:67)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:366)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:120)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:161)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:57)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:96)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:52)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:93)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:362)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:102)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:225)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:39)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:91)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:103)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:606)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:455)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:1029)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:1071)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:1028)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:454)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:835)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: kotlin.KotlinNullPointerException
at org.jetbrains.kotlin.psi.KtQualifiedExpression$DefaultImpls.getOperationTokenNode(KtQualifiedExpression.kt:35)
at org.jetbrains.kotlin.psi.KtDotQualifiedExpression.getOperationTokenNode(KtDotQualifiedExpression.kt:25)
at org.jetbrains.kotlin.psi.KtQualifiedExpression$DefaultImpls.getExpression(KtQualifiedExpression.kt:41)
at org.jetbrains.kotlin.psi.KtQualifiedExpression$DefaultImpls.getSelectorExpression(KtQualifiedExpression.kt:32)
at org.jetbrains.kotlin.psi.KtDotQualifiedExpression.getSelectorExpression(KtDotQualifiedExpression.kt:55)
at org.jetbrains.kotlin.psi.KtPackageDirective.getPackageNames(KtPackageDirective.java:61)
at org.jetbrains.kotlin.psi.KtPackageDirective.getQualifiedNameOf(KtPackageDirective.java:158)
at org.jetbrains.kotlin.psi.KtPackageDirective.getQualifiedName(KtPackageDirective.java:149)
at org.jetbrains.kotlin.psi.KtPackageDirective.getFqName(KtPackageDirective.java:111)
at org.jetbrains.kotlin.psi.KtFile.getPackageFqNameByTree(KtFile.kt:95)
at org.jetbrains.kotlin.psi.KtFile.getPackageFqName(KtFile.kt:83)
at org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory.computeFilesByPackage(FileBasedDeclarationProviderFactory.java:54)
at org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory.lambda$new$0(FileBasedDeclarationProviderFactory.java:47)
at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:354)
at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:410)
at org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory.packageExists(FileBasedDeclarationProviderFactory.java:70)
at org.jetbrains.kotlin.resolve.lazy.declarations.AbstractDeclarationProviderFactory.getPackageMemberDeclarationProvider(AbstractDeclarationProviderFactory.java:41)
at org.jetbrains.kotlin.resolve.lazy.ResolveSession.getPackageFragment(ResolveSession.java:213)
like image 776
Jithish P N Avatar asked Feb 06 '19 10:02

Jithish P N


4 Answers

This problem is solved by cleaning and rebuilding the project.

like image 160
Sudip Sadhukhan Avatar answered Nov 03 '22 06:11

Sudip Sadhukhan


Build > Rebuild Project on intellij 2020.1 fixed it

like image 32
xilef Avatar answered Nov 03 '22 05:11

xilef


Go to your project folder and delete the build folder and the out folder, then retry, it works for me.

like image 12
Bubu Avatar answered Nov 03 '22 06:11

Bubu


My answer worked :

File -> Invalidate Caches -> Invalidate and Restart

like image 3
Halil Ozel Avatar answered Nov 03 '22 05:11

Halil Ozel