Gradle has a bug where the plugin sonar-runner does not work properly. There is a fix in the nightly builds (2.1-rc1) which fixes this issue. However, the plugin android studio uses is way older than 2.1-rc1. And it’s not possible to use the newer gradle binary when building in android studio or outside.
For version control I use gitlab and for continous integration testing I use gitlab-ci. Gitlab-ci uses runners that are decoupled from the server that hosts the code, which for security reasons is great.
So this post is a guide in how to install a gitlab-ci runner with a sonar runner. Tested and working on Ubuntu 14.04.