Fix buildscript.gradle and upgrade Gradle to 1.11.

Fix buildscript.gradle which wasn't working because the variables were not defined in the correct scope.
Upgrade Gradle version to 1.11.