Updated to work with latest SDK

I've made the changes necessary for things to work smoothly with the latest SDK and Android Studio. Tested on my work machine and home machine.

@mdpye Want to check it works for you before we pull it in?