How do I "select Android SDK" in Android Studio?

After a successful import of an Eclipse-Android-Project into "Android Studio 1.4", I get the error

"Please select Android SDK"

when I click on the button to run the application in simulator, but I can't find any way of doing that.

This dialog opens when I click on "run":

This dialog opens up when I click on "run"

This is the "project structure" dialog:

Screenshot of the "project structure" dialog

What should I do now?


Solution 1:

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.

Sync Project Icon

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

Solution 2:

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 didn't help us. For us, the solution was a bit different:

  1. File -> Invalidate Caches -> Invalidate
  2. File -> Close Project.
  3. Remove the project from the AS project selector window.
  4. Quit from Android Studio
  5. Start AS and open project again

reopen project instructions

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 haven't seen this issue since then.

Solution 3:

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! It'll sync your gradle file with your project file.

Screenshot:

enter image description here