Building my Android app takes about 90 seconds ("fast"), up to 3 minutes for each update to my code. It's a complete waste of time as it really and I assume a solution must be within reach. I tried investigating the issue and found different blog-posts and SO answers with suggestions, most of which I've tried.
- I have the gradle.properties file with org.gradle.deamon=true
- I run on Android Studio with Gradle Prefence to do offline work (improved, but still slow)
- I run on command line (which is faster, but still slow)
- In build.gradle, defaultConfig, I have multiDexEnabled set to false
- In build.gradle, dexOptions, I have preDexLibraries set to false
- In gradle-wrapper.properties I fetch a recent gradle version (2.8) (the significant speed changes happened on 2.4)
The process that seems to take long, about 85% of total build time is :app:transformClassesWithDexForDebug
What is that process actually doing? I can find people who have crashes on it, but it works fine for me, except for the fact that it takes a lot of time. And do I need it, since I don't really need Dex at this point?
Also, I have 13 dependencies and 3 testCompile dependencies. I already point to specific play packages, so I'm not compiling stuff I don't need. If I understand things correctly, gradle is building all those libraries each project build as well. If that is correct, is there a way to skip that? Can I build them myself as wrapped-up libraries and include them without the need for them to be processed each time? That might make me lose some flexibility for future changes to dependencies, but at this point I feel like I'm losing over an hour a day easily on waiting for gradle. I'm not sure if flexibility is worth that much to me.
I'm looking forward to get any pointers on how I can improve my build process. Thank you in advance.