In Android Studio:
Windows: File -> Settings (ctrl+alt+s) -> Appearance & Behavior -> System Settings -> Android SDK.
Mac: Android Studio -> Preferences (cmd + ,) -> Appearance & Behavior -> System Settings -> Android SDK.
Click on Edit on the right of the Android SDK location. Click Next all the way through the wizard and this should fix the problem.