How to fix the SDK location not found error in Android Studio
A solution for fixing the error "SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at."
This article aims to solve the issue that arises when your Android Studio cannot find the Android SDK location, producing an error similar to that shown below.
Step One: Make sure that the file exists
Make sure that the local.properties file exists.
If it does not, create it.
Step Two: Add the SDK path
In the local.properties file, add the line below.
sdk.dir=/Users/YOUR_USERNAME/Library/Android/sdk
Make sure to replace YOUR_USERNAME with the username that appears on terminal.
If you open your terminal, you should see YOUR_USERNAME@YOURMACHINE in the area where the red box is above.
Copy YOUR_USERNAME from your terminal to make sure that you give the SDK the right location.