Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

677
Views
kaptGenerateStubsDebugKotlin fails on a Apple M1 Macbook (JDK 11)

I get this failure both in Android Studio and running ./gradlew assembleDebug on the command line on a new Macbook with Apple M1 Max chip. On my old Intel Mac there are no problems building the project.

> Task :app:kaptGenerateStubsDebugKotlin FAILED
e: java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext (in unnamed module @0x4d1ecff7) 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 @0x4d1ecff7
        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)

(Here's the full error output)

class org.jetbrains.kotlin.kapt3.base.KaptContext (in unnamed module @0x4d1ecff7) 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 @0x4d1ecff7

Googling around, the error message looks a lot like the one here: "Kapt is not compatible with JDK 16+". But thing is, I'm using JDK 11. (Same result on both Android Studio's default JDK (11.0.10) and "11.0.13 2021-10-19 LTS" downloaded from www.oracle.com.)

Any ideas how to get this working on the M1 Mac?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

From the link mcomella has shared - https://youtrack.jetbrains.com/issue/KT-45545, they have fixed it in Kotlin 1.6.x.

So bumping to Kotlin 1.6.x has worked for my case (Apple M1 Pro).

over 4 years ago · Santiago Trujillo Report

0

I solve it in my MacBook Air M1 updating the Kotlin version and all other library for the last version, you have to update the compileSDKVersion and targetSDKVersion for the latest version as well.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!