简体   繁体   English

java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext Android

[英]java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext Android

I've been getting an error like this for days, but I couldn't find a solution.几天来我一直收到这样的错误,但我找不到解决方案。 Can you please help me?你能帮我么?

What could the problem be caused by?问题可能是由什么引起的?

Error:错误:

java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext (in unnamed module @0x6acdb135) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x6acdb135
    at org.jetbrains.kotlin.kapt3.base.KaptContext.<init>(KaptContext.kt:28)
    at org.jetbrains.kotlin.kapt3.KaptContextForStubGeneration.<init>(KaptContextForStubGeneration.kt:40)
    at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.contextForStubGeneration(Kapt3Extension.kt:287)
    at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:171)
    at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:102)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$invokeExtensionsOnAnalysisComplete(TopDownAnalyzerFacadeForJVM.kt:112)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:122)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:86)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:252)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:243)
    at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:113)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:243)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:90)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:56)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:412)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:112)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:358)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:300)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:119)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:170)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:81)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:607)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:96)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1658)
    at jdk.internal.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)


Execution failed for task ':app:kaptGenerateStubsMacellanDebugKotlin'.
> Internal compiler error. See log for more details

I found a solution and fixed this damn problem :D我找到了解决方案并解决了这个该死的问题:D

I recommend using, adding it to the root build.gradle.我建议使用,将其添加到根 build.gradle。 This will force using the given dependency in the whole project:这将强制在整个项目中使用给定的依赖项:

build.gradle (Project) build.gradle (项目)

allprojects {
    configurations.all {
        resolutionStrategy {
            force 'org.xerial:sqlite-jdbc:3.34.0'
        }
    }
}

将 JAVA_HOME 切换到 java 1.8 并重新启动 Android Studio 后,问题就解决了。

I was able to solve this problem by adding following workaround:我能够通过添加以下解决方法来解决此问题:

org.gradle.jvmargs=-Xmx1536m --illegal-access=permit

to gradle.properties file.到 gradle.properties 文件。

You can solve this by switching Java version to Java 15 .您可以通过将 Java 版本切换到Java 15来解决此问题。 Also if you are working with gradle on Intellij IDEA, change java also in File> Settings > Build, Execution, Deployment > Build Tools > Gradle .此外,如果您在 Intellij IDEA 上使用 gradle,请在File> Settings > Build, Execution, Deployment > Build Tools > Gradle中更改 java。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.IllegalAccessError:org / apache / xml / serializer / ExtendedContentHandler - java.lang.IllegalAccessError: org/apache/xml/serializer/ExtendedContentHandler Selenium中的java.lang.IllegalAccessError - java.lang.IllegalAccessError in Selenium 避免java.lang.IllegalAccessError的Java动态类加载 - java dynamic class loading that avoids java.lang.IllegalAccessError Android Studio上的Java错误java.lang.IllegalAccessError - Java Error on Android Studio java.lang.IllegalAccessError 线程“主”java.lang.IllegalAccessError 中的异常:无法访问 class - Exception in thread "main" java.lang.IllegalAccessError: failed to access class 黄瓜java.lang.IllegalAccessError中的Spring错误:尝试访问类 - Spring error in Cucumber java.lang.IllegalAccessError: tried to access class 当添加 ZXing 依赖项时,Java 中的 Selenium 停止使用 java.lang.IllegalAccessError:from class org.openqa.selenium.net.UrlChecker - Selenium in Java stops working with java.lang.IllegalAccessError:from class org.openqa.selenium.net.UrlChecker when ZXing dependency is added java.lang.IllegalAccessError:超类访问检查失败:class org.apache.poi.openxml4j.util.ZipSecureFile - java.lang.IllegalAccessError: superclass access check failed: class org.apache.poi.openxml4j.util.ZipSecureFile Java 10 JavaFX java.lang.IllegalAccessError - Java 10 JavaFX java.lang.IllegalAccessError 未捕获的异常 java.lang.IllegalAccessError: - Uncaught Exception java.lang.IllegalAccessError:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM