Convert to new Gradle-based build system

I'm still figuring this new build system out myself, but I think I've done it correctly. I'm able to build both the library (a library archive is produced) and the sample just fine.