Error: SDK location not found even though it is correct in local.properties

I have cloned an Android project:

$ git clone https://me@bitbucket.org/company/company-android-app.git
$ cd company-android-app
$ ls
app/               build.gradle       firebase/          gradle/            
gradle.properties  gradlew            gradlew.bat        settings.gradle    

When I try to open the app folder with android studio to start working with the project, I get Gradle 'app' project refresh failed and Error: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.. The thing is, the SDK location is already set in local.properties:

sdk.dir=/Users/me/Library/Android/sdk

This is the same location as in other android projects that I have worked with on this machine. So why am I getting this error, and how to fix it?

EDIT Additional info: I've checked in the configurations that the path has been set properly:

enter image description here

I can't see anything wrong with this.

2 answers

  • answered 2018-07-12 08:00 seyed Jafari

    Happened to me on a Windows 10 machine, had delete .Android , .AndroidStudio and .gradle folder (entire android studio cache) and start fresh. at the very beginning of android studio setup it asks for sdk location i provide it there and it worked like charm

  • answered 2018-07-12 08:10 Sahand

    When I first opened the project in Android studio, I opened the /app directory. When I closed the project and opened the enclosing folder instead, it worked.