this adds roughly 21 seconds to the build not 1-2 mins… or even 4 like some people are saying…
if you are redownloading the build tools each build you DO NOT have circleci configured properly.
the dependencies are supposed to be cached. My build runs a step called restore cache for 17 seconds, but after that 17 seconds the same script that usually takes over 1 minute to download dependencies just does a filesystem check that the cache has not been invalidated and is present and continues on, takes 9 seconds. My Build command that used to take 2:50 + to download gradle and build the apk is about 1 minute quicker as it no longer needs to download gradle.
this isnt exactly what im using but it gives you the jist…
in a bash script
if [ ! -e BTOOLS]
echo "Cache invalidated updating sdk"
echo y | android update sdk -u -a -t "tool"
echo y | android update sdk -u -a -t "build-tools-23.0.2"
echo “Cache restore complete, sdk updated”
you either see it say invalidated then download everything and then say cache restore complete or after 1 successful build with dependency download + save and after that it will only say echo cache restored sdk updated and take SECONDS to get there…
you also need to add
in your YAML so that circleci knows to save the files you updated the sdk with for the next container you are given.
circleci’s support… and documentation is TERRIBLE.