Add gradle support, fix some warnings.