-->

Error: Please select Android SDK in Android Studio

2019-04-03 16:01发布

问题:

I am using Android Studio 2.0 Beta2, and i am trying to run old project that uses google maps api v1 (package com.google.android.maps) as *.jar file. To run this old project i need specify compileSdkVersion older than the last one (23). I used

compileSdkVersion 'Google Inc.:Google APIs:17'

But i got Error: Please select Android SDK error in Android Studio. How i can run this old project with older compileSdkVersion?

回答1:

Open gradle.buld in your app module change versionCode or versionName and sync.



回答2:

Also just sync the project from the tool bar



回答3:

the easiest way is to:

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



回答4:

With Android Studio 2.1.3, I got this message when trying to launch my app.

I used the Module Settings dialog in AS to select another compile SDK version. Then I went back to the same dialog and chose Google API 17 again.

Then AS accepted the settings and could launch my app.

Really weird, as the contents of the build.gradle file is identical to what it was when I had the error message.



回答5:

I could fix the problem in my case you need to set the compileSdkVersion and the buildToolsVersion manually in the android studio. I don't know why the android astudio doesn't recognize the value from gradle.

So the steps are:

File/Project Structure/Flavors/

and set the buildToolsVersion and compileSdkVersion.

But you need to check, because the android studio puts this value at the end of the gradle file and if you have replicated this variables, the gradle build make an error. So I make cut and paste in here

android {
    defaultConfig {
        compileSdkVersion 22
        buildToolsVersion '22.0.0'
        minSdkVersion 15
        targetSdkVersion 22
        versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionDevel
        versionName "${versionMajor}.${versionMinor}.${versionPatch}.${versionDevel}"
        multiDexEnabled = true
    }

and that's it!



回答6:

It is works for me

intelliJ IDEA 13 error: please select Android SDK

My Problem: "please select Android SDK", But everything is okey :( -> I think one of IntelliJ file was crashed (after blue screen of death)

My resolution:

File -> Settings -> Android SDK -> Android SDK Location Edit -> Next, Next (Android SDK is up to date.), Finished

... and crashed file was repaired!

I hope this will help!



回答7:

I just went to my Gradle button on the far right of the screen on the side and refreshed it and it worked for me.