Posted on

Android Faster Builds with Buck



Designed by Freepik

We all have been using Gradle since Google switched to it as official Android build system, but it’s not the fastest one. Today we’re going to look at Buck by Facebook, a way faster build system. Instead of minutes you build in seconds.

 

Buck

Although faster, it’s not as simple in setup, you can check this page for official doccumentation,  that’s why we’re goint to use a Gradle Plugin by Uber – OkBuck

OkBuck

Using Gradle Plugin is way simpler and you won’t need to change entire build code and learn new syntax. To enable it add those lines to your project’s build.gradle

Then run those commands if you’re on Mac

or those if you’re using Linux

Then run this command from your project

Build

To see list of possible build use

If you don’t have any flavors, then run

Otherwise bin_flavorDebug.

Signing

It will complain that you didn’t set release signing, add those lines to your build.gradle

And retry build command.

Release signing

As you see we use the same config for both debug and release builds, that’s ok for development so that it doesn’t compain. If you decide to stick with OkBuck, then you do the following, otherwise you can skip this part. Set release congif by putting those lines to local.properties file. This is the same debug config, replace it with your release when ready. Since this file is in git ingored by default you’re not risking to share it with anybody

replace storeFile with your path to release or debug keystore for now. And change release config to this

Apply it in buildTypes for release build

Install

Finally, let’s install and run our app

Limitations

Ok, so Buck more perfomant than Gradle, but there’s some limitations with Android yet. Most discouraging is not supported Data Binding and Kotlin, but they will come later. If you don’t use Kotlin, you can stick with Butterknife instead of Data Binding, which is supported, and try yourself if it’s faster to build with Buck.

Yes, Gradle runs great when you have an empty project and just started your IDE, what really matters is the middle of the day, that’s when it’s slow as never. So try it out, I’ve just recently discovered Buck, will write my review later

 

Alrgiht, that’s it for Buck build system so far, you can check source code here. Don’t forget to subscribe, follow me on Twitter, Facebook, G+ and share with friends if you think they will benefit from it!