Module jdk.compiler does not export com.sun.tools.javac.util.. Compile time error
Asked Answered
W

4

9

Getting this error while building the shadowsocks project.

(https://github.com/shadowsocks/shadowsocks-android)

java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext (in unnamed module @0x1d312b6c) 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 @0x1d312b6c at org.jetbrains.kotlin.kapt3.base.KaptContext.(KaptContext.kt:28)

Wingo answered 30/3, 2022 at 9:57 Comment(2)
Please provide enough code so others can better understand or reproduce the problem.Declan
Did your issue got resolved ? @MohammadRaylenerayless
S
1

I encountered this problem when running an old app. My original kotlin version was 1.3.72 and i updated it to 1.8.21 and my problem was solved.

Symer answered 7/8, 2023 at 16:39 Comment(3)
What was your original Kotlin version and what version did you update to?Airy
My original kotlin version was 1.3.72 and i updated it to 1.8.21Symer
Edit your answer and add the details. Don't post answer details in a comment.Airy
N
0

More descriptive solution:

  1. Go to build.gradle file
  2. In the module config, for the Kotlin implementation, make sure it reflects the latest plugin Module build.gradle file
  3. Android Studio will highlight, describe the issue & suggest a correct version
  4. Edit it an build again
  5. In my case the Kotlin version is specified in the Project's build.gradle file

Project build.gradle file

Nemesis answered 9/8, 2023 at 14:51 Comment(1)
I am having the same exact problem with the same project (testing codelab), i have tried changing kotlinVersion to 1.8.2 (recommended by the IDE) but this did not workConsistent
Q
0

I solved this problem by downgrading my kotlin version from 1.7.10 to 1.7.0, there might be some compatibility issues between Kotlin version and other components(likely the JDK).

Quartus answered 19/9 at 12:15 Comment(0)
T
-1

I faced this problem by updating kotlin version in android studio but not changing buildscript { ext.kotlin_version = 'specify new version here'} in build gradle

Tarweed answered 29/11, 2022 at 11:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.