Migrate to gradle.
Minor changes to make it work on L.