Extends:http://stackoverflow.com/questions/19272127/sdk-location-not-found-android-studio-gradle
I had very similar situation (had a project on another machine and cloned it to my laptop and saw the same issue) and I lo OKed in it.
Error message is coming from Sdk.groovy of Android Gradle Plugin:https://android.googlesource.com/platform/tools/build /+/master/gradle/src/main/groovy/com/android/build/gradle/internal/sdk.groovy
By looking in code, its findlocation needs to set androidsdkdir variable and there is only three ways to do it:
Create Local.properties file and has either Sdk.dir or Android.dir line.
There are android_home environment variable defined.
System.getproperty ("Android.home")-I ' m not sure how it works, but it seems like a Java thing.
While your Android studio knows that the SDK are at this place, I doubt that Android studio was passing that information to Gradle and thus we ' re seeing that error.
I created Local.properties file at the project root and put the following line and it compiled the code successfully.
Sdk.dir =/applications/android studio.app/sdk/
SDK location not found Android Studio + Gradle