Android Studio: “Please select Android SDK”

匿名 (未验证) 提交于 2019-12-03 03:06:01

问题:

After a successfull 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 possibility to do that.

This dialog opens up when i click on "run":

This is the "project structure" dialog:

What to do now?

回答1:

I go to build.gradle and click sync now. Then it worked.

Update :
Tools -> Android -> Sync Project with Gradle Files (Android Studio 3.0.1)



回答2:

click this icon to sync gradle

or edit any of your module gradle and then sync



回答3:

Press "Ctrl+shift+A" and in the pop-up EditText, write "Sync Project with Gradle Files". After that double click on the appeared option. It will then sync your Gradle file SDK with the project file.



回答4:

The comment from @Nisarg helped: "set latest version in Compile Sdk Version"

I changed from API 8 to API 23 and the error message disappeared.



回答5:

Just change build tools version to 25.0.3.. and sync now I hope it will help..



回答6:

This worked for me.

File -> Settings -> Android SDK -> Android SDK Location Edit -> Android SDK



回答7:

app module. Then choose the Compile SDK version . Choose the latest one and click apply.



回答8:

I just restarted my Android Studio, then it rebuilt the project, the error disappeared.



回答9:

Follow these steps:

  • Goto Android Studio Settings
  • Search for "Android SDK" using search bar
  • Ensure the path to your android sdk folder is correct.
  • After that also ensure the path is automatically updated after a prompt in your project (local.properties) file. If not, do it manually.

Hope this helps.



回答10:

Just Go to the Gradle(app) file and Make Sync , once gradle shows Sync Complete then the Error. will gone



回答11:

Cleaning and Re-syncing Gradle files worked for me.



回答12:

After opening my project in Android Studio, I opened the App version of the build.gradle file, located in the Gradle Scripts folder of the Project. When I hovered my mouse pointer over the buildToolsVersion number, a tooltip popped, indicating that the version of Android Build Tools needed to be upgraded (see screenshot). I changed the value of the buildToolsVersion to the one identified by the error (27.0.2) and the problem was solved. The original error (Please select Android SDK) went away and the project compiled successfully, again. Although this solution was mentioned previously, the exact steps seemed to be missing, so hopefully this clears up any doubt. I guess the root cause for this problem is that a new version of the build tools were released but Android Studio did not trigger any notification to me, which would have indicated that I should manually fix this (since Android Studio does not seeem to have the ability to upgrade this build.gradle file internally), which leaves the onus on the user to find the problem and fix it.



回答13:

In my case there there is no selected java sdk version in project structure-

I had to select the -

1.Source Compatibility (1.7)

2.Target Compatibility (1.7)

as shown in image.



回答14:

open build.gradle file. just add a space or press enter. then sync project. it works...



回答15:

I know it's an old question, but still might help somebody. In my case, I renamed the SDK directory, and restarted Studio, which forced it to ask for SDK location. After selecting SDK location, the error was gone.



回答16:

Source Compatibility should be selected as the minimum Android Version that your app should be compatible with(usually selected as SDK 15), Target Compatibility should be selected as the newest Android Version that your app should be compatible with(SDK 23). Afterwards you want to check your AndroidMenifest and your gradle.build to see if its realy set to the properties selected if not you can just add it manually. and ofcourse you should check the SDK Location is actually pointing to your android studio SDK folder (if you are importing from Eclipse then you should point to your Eclipse SDK folder).



回答17:

For Android Studio 2.1, click on Project, and you will see highlighted in red, a drop-down menu to select the missing information.



回答18:

You are using Google API SDK. This for some reason doesn't work anymore with the embedded java JDK / JRE.

Follow the solution I described here and set Android Studio JDK path to your local JDK (ex. OpenJDK)



回答19:

please check your sdk version and sdk tools are in the sdk manager and you project's gradle.properties setting such as : BUILD_TOOLS_VERSION=25.0.1 COMPILE_SDK_VERSION=25



回答20:

Give SDK path in local.properties file as

sdk.dir=C\:\\Users\\System43\\AppData\\Local\\Android\\sdk 

and give latest version in compilesdk in gradle file.



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