Gradle-ize project and fix compile errors