Update gradle settings to work with latest Android Studio and make build more stable

This also installs a versions plugin that allows you to run

    ./gradlew tasks

to see when your dependencies can be updated. This way you may more easily pin dependencies to exact versions.