I'm trying to use Android Studio, and the first time I boot it up, it takes like 45 MINUTES to compile... If I don't quit the application, it is okay - each subsequent compilation/running the app will take like 45 seconds.
I've tried to check some of my caches: there's a .gradle/caches
folder in my home directory, and it's like 123 MB large.
There's also a .gradle
folder in my project folder... one of the taskArtifacts
was like 200 MB. I'm scared to just randomly nuke them both. What parts of the folders are safe to delete?
Is there a better explanation for why my Android Studio is taking forever to run the gradle assemble
task upon first time loading the application?
Do I also have to clear the intellij cache too?
Newest solution using gradle task
cleanBuildCache
available via android plugin for Gradle, revision 2.3.0 (February 2017)
Dependencies:
more at:
https://developer.android.com/studio/build/build-cache.html#clear_the_build_cache
background
Build cache:
stores certain outputs that the Android plugin generates when building your project (such as unpackaged AARs and pre-dexed remote dependencies). Your clean builds are much faster while using the cache because the build system can simply reuse those cached files during subsequent builds, instead of recreating them. Projects using Android plugin 2.3.0 and higher use the build cache by default. To learn more, read Improve Build Speed with Build Cache.
Note: The cleanBuildCache task is not available if you disable the build cache.
usage:
windows
linux / mac
Android Studio / IntelliJ
**gradle/gradlew are system specific files containing scripts - please see system info how to execute the script