SDK location not found Android Studio + Gradle

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.