Is it possible to set android sdk path via script?

Sometimes in our company we install a new version of unity or set up a new build machine and forget to open unity and set the android sdk path. When that happens Unity never fails or complete the command line build, it keeps opened forever.

It would be nice if I could just update my build script to include the sdk path, is there a way to do it?

Actually, it is possible. I’ve written a short article on how to do it.

TL;DR: EditorPrefs.SetString("AndroidSdkRoot", "/path/to/sdk");