Reputation: 1187
These are a series of questions for Android Studio programmers who have worked on large projects before. So, before I list the questions let me explain why I'm asking.
I couldn't help but notice it taking 36+ seconds for Gradle to sync and build for me to start programming every time I launch AS. It's not so much a problem now, but how about when the project starts to get over 26,000+ lines of code? So, now my real questions are:
1) Do large projects take significantly longer for Gradle to sync and build than a small one?
2) If it does, are there any levels of refactoring/error catching that I could bypass in the sync/build to make the process faster in the long run?
3) My computer can run any game on full ultra quality. Is a system spec that makes compiling and programming language processing faster than a gaming spec?
Thanks to all who contribute, and you will be acknowledged (with at least a vote) regardless of whether you can answer all the questions or not!
Upvotes: 1
Views: 347
Reputation: 3107
Lucky you. Gradle speeds have increased considerably over the last two years. As of today, even though still a bit slow, I'm pretty satisfied with the speed. Anyhow. Regarding your questions, here's my two cents:
Yes. But it's not a linear "function". I haven't come across any project that takes more than 3 or 4 mins tops when configured correctly, one especially was pretty big.
The only way to "speed up" the process is to allocate more memory. There are two ways here, inside the inner (module) gradle file, you can do this:
dexOptions {
javaMaxHeapSize "5g"
}
Or you can define a field inside the gradle.properties file:
org.gradle.jvmargs=-Xmx5632M
Enjoy developing.
Upvotes: 1
Reputation: 1072
Yes, larger projects will take longer to sync and build. Lines of code is a contributing factor, as well as dependencies, number of assets, etc. Gradle is also somewhat infamous for being a bit slow.
This is dependent on your individual Gradle configuration. Removing unneeded steps (if you have configured some), such as signing the APK, may also help. 'Instant Run' is very quick for small changes but is somewhat untrustworthy. There's no way to 'skip' steps of compilation - if a recompile is needed, a recompile is needed. Trust that the compiler and IDE will optimise out any unnecessary steps and ensure that you are not asking for any unnecessary extra steps.
Gaming computers generally have fairly beefy processors, which are the main component used to sync and build a project. The disk read speed of your hard drive will also be a factor - SSDs will be much faster than platter drives - but it's comparatively much less important than your processor. Your video card, the other big component in a gaming PC, will not be used at all to build. A solid gaming PC will be more than adequate for development.
There are a few ways to shave time off your Gradle build times (for example) but build times will always be a reality.
Upvotes: 1