Fix gradle build

This pull request fixes several problems which make this build fail on android studio.

One of the things I wasn't sure is to what extent are you planning to support the eclipse build.