adapting code to run on gradle 2