fix The selected directory is not a valid home for Android SDK code example
Example: the selected directory is not a valid home for sdk
After the installation, immediately close Android Studio,then start it as administrator.
A message might popup asking for the sdk manager location.
Ignore it (Close the popup).
Go to Tools > SDK Manager and click on the edit button on the right of Android SDK Location.
Then click Next, next and you're good to go.
Android Studio will let you install the sdk manager.