Google developed Android SDK which is a Software Development Kit developed by Google for the Android platform. You can create Android apps using Android SDK, and you don’t need to be an expert to use it. Android SDK and Android Studio come bundled together, with Google’s official integrated development environment (IDE) for the Android operating system.
In this article, we see how to fix an error that is related to the main Android building component of Android Studio that is the Android SDK. The most common error related to Android SDK is “SDK location not found“. This message pops up stating that the location of Android SDK was not detected when the path of SDK is assigned incorrectly. There can also be other reasons for this error message as well and we will see ways to get rid of this error.
When switching from one IDE to another (Like from Eclipse to Android Studio)
In this case, follow the below steps:
- Go to your project then go to the android directory and create a file with the following name – local.properties
- Open the file and paste your Android SDK path like below:
- For Windows user – sdk.dir=C:\\users\\Username\\AppData\\Local\\Android\\sdk
- For Mac user – sdk.dir = /users/Username/Library/Android/sdk (Replace Username with your PC name)
In case the above procedure doesn’t work then add the ANDROID_HOME variable in “Environment Variables” as C:\Users\Username\AppData\Local\Android\Sdk.
In case it does not work even then, then you need to change the directory path on Project Structure as well.
- Close the current project and you’ll see a pop-up with a dialog which will then proceed to Configure option.
- Configure -> Project Defaults -> Project Structure -> SDKs on left column -> Android SDK Home Path -> give the exact path as you did on local.properties and select Valid Target.
A settings.gradle file might be missing from the project. Make sure that the file exists from the project you are importing. If not add the settings.gradle file with the following:
Save the file and put it in the top-level folder in your project.