Compilation takes too long


#1

I have similar problem when I run Jnit test. I have just created a new Kotlin project and my project has just 12 classes at the moment.
I am using Java 1.8.0_45 + Android Studio 3.0 + Kotlin1.1.51 + BuildTool 26.0.1 in MacOS Siera 10.12.5.

As you see in the attached screenshot, the compile time is incredibly slow. I don’t have any idea what’s going on.


Code completion still very slow in IDEA
#2

Are you using Robolectric? I was having similar issues with Robolectric and tests where the tests would take minutes to even start. I never quite identified what the issue was, but something was getting stuck somewhere. It’s possible Robolectric isn’t the issue, but Android unit testing in general.

It might be helpful to include your project, and to create an Android issue for this as well: https://issuetracker.google.com/issues


#3

Try to turn off Internet (disable WiFi or Ethernet adapter). I experienced slow compilation because of some network issues, I never was able to understand the root issue.