Gradle-ify projects; split into demo and library.

Note: modelling the library as an Android library project, but a normal jar would work fine since we do not currently have any resources. Library project is a lot easier to get working.