build fixes
These are a bunch of build-related things mostly around gradle. More comments in the commit messages.
This also adds long timeouts to gradle so that it hopefully stops failing when it fails to download a dependency.
Edited by Hans-Christoph Steiner