Could not delete caches dir when compile Kotlin in Intellij IDE

Viewed 5104

My project use plugin kapt to generate mapper.

When run app then can not compile Kotlin (image below) If remove plugin kapt then it not happend. To resolve I must restart Intellij IDE. Take more time.

This error probably only happen on windows enter image description here

5 Answers

I have this problem almost every build (Android Studio stable + Artic Fox).

Manual Solution (try this first, if it works continue)

Task manager > Processes > End "OpenJDK Platform Library" tasks (sometimes it's standalone, sometimes it's under "Android Studio")

OR

Task manager > Details > End "java.exe" tasks

Automated Solution

  1. Create a new end-java.bat file
  2. Content of .bat file: taskkill /f /IM java.exe
  3. Right click end-java.bat file > create shortcut
  4. Right click the shortcut > properties
  5. Add shortcut key (e.g. ALT + CTRL + 1)
  6. ALT + CTRL + 1 will now fix the issue

Also you can try to use a different JDK (e.g. OpenJDK). It helped me.

File -> Project Structure -> SDK Locations -> JDK Location

Related