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"

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 06/12/2023 at 10:15
Last Updated on 06/12/2023 at 11:38
A flower that represents Android Studio. Beneath it sits the text "SDK Location not Found."

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."

SubscribeDownload Open Source Kotlin Starter Project

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.

A screenshot of Android Studio, showing the error that begins with "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 " and ends with the location of the local properties file.

Step One: Make sure that the file exists

A screenshot of Android Studio showing the location of the local.properties file. It is found at the root of the project.

Make sure that the local.properties file exists.

If it does not, create it.

How to create a file, folder or resource in Android Studio

Step Two: Add the SDK path

A screenshot of Android Studio showing the local.properties file with the sdk.dir added.

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.

A screenshot of Terminal showing a red box over the area that shows the name of your username and your machine.

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.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe