Fix SDK directory is not set for Mac OS X.
Add .gitignore.
Reformat code and optimize imports.