How do I select Android SDK in Android Studio?
How do I select Android SDK in Android Studio?
I go to build.gradle
and click sync now. Then it worked.
Update :
File
-> Sync Project with Gradle Files
(Android Studio 3.1.1)
Tools
-> Android
-> Sync Project with Gradle Files
(Android Studio 3.0.1)
Or You can click on the icon from the toolbar.
This answer may not help works for later version as Android studio Team work on making the tool more better, the way to sync may be different in the next version of Android Studio.
COMMON WAY that may helps is try to sync project and then Invalidate Caches and Restart Android Studio.
Solution for Android Studio 3.1.2
[See below answer]
See Latest Android Studio version
FIX FOR 3.1.2 OR NEWER VERSIONS
Some of my colleagues and I have faced the same issue on AS 3.1.2, but a simple Sync didnt help us. For us, the solution was a bit different:
- File -> Invalidate Caches -> Invalidate
- File -> Close Project.
- Remove the project from the AS project selector window.
- Quit from Android Studio
- Start AS and open project again
EXTRA ADVICE IF YOU ARE FACING THIS ISSUE CONSTANTLY
Some of you are constantly facing this issue, and this solution fixes it only temporarily. At the time we started getting this error, we used gradle wrapper 4.6 and Android gradle plugin 3.1.0, but since then we went back to gradle 4.4 and we use it with the latest Android gradle plugin, and we havent seen this issue since then.
How do I select Android SDK in Android Studio?
In Android Studio 3 and above, for Windows, Mac and Linux:
File -> Sync Project with Gradle Files
Solved!
Or you can do this by shortcut key:
Press ⌘ + Shift + A (Mac) or Ctrl + Shift + A (Windows, Linux). Then pop-up a Edit-Text and write Sync Project with Gradle Files
. Then press double click on the option.
Your problem is solved! Itll sync your gradle file with your project file.
Screenshot: