SDK Location not found

拈花ヽ惹草 提交于 2021-02-17 19:20:08

问题


I created recently a new local repo and pulled some code to it, from our remote repository.

When i open the project, I receive a message in console:

Gradle sync failed: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
     Consult IDE log for more details

I followed the instructions here to set the environment variable (Im in a Mac) and checked my local.properties:

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

So, both things are settled up, and I am still getting this error. Ive searched, but no solution worked for me.

Any help? Thank you.

EDIT:

This only happens with one project. The rest of the projects works perfectly.


回答1:


In Android Studio:

  1. Open your project navigator
  2. Pick the root item, right click --> Open Module Settings.
  3. In the Android SDK location field, make sure the correct path is selected (up to the sdk folder). See example below:




回答2:


I had the same issue and tried the above comments. Later on the error changed to

"Gradle sync failed: failed to find Build Tools revision 23.0.1 Consult IDE log for more details (Help | Show Log)"

It installed the revision then the gradle build completed. So try updating your SDK.




回答3:


On Linux(Ubuntu 16.04) you can set the ANDROID_HOME environment variable by editing the ~/.bashrc file, by running nano ~/.bashrc then adding the environment variable which points to the path of your Android Sdk in my case which is '/home/kbuhiire/Android/Sdk' thus the environment variable looks something like this. export ANDROID_HOME='/home/kbuhiire/Android/Sdk' and after saving the file run source ~/.bashrc.



来源:https://stackoverflow.com/questions/32177349/sdk-location-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!