Error: Please select Android SDK in Android Studio

2019-04-03 15:43发布

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?

7条回答
地球回转人心会变
2楼-- · 2019-04-03 16:11

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.

查看更多
仙女界的扛把子
3楼-- · 2019-04-03 16:17

Also just sync the project from the tool bar refer the image

查看更多
Juvenile、少年°
4楼-- · 2019-04-03 16:19

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

查看更多
乱世女痞
5楼-- · 2019-04-03 16:21

the easiest way is to:

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

查看更多
叼着烟拽天下
6楼-- · 2019-04-03 16:25

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.

查看更多
爱情/是我丢掉的垃圾
7楼-- · 2019-04-03 16:37

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!

查看更多
登录 后发表回答