I have a problem on an Android studio project. The project is compiled with Google APIs 24, but I can't run it from Android Studio. I'm able to build the project and generate an APK, and if I install it manually or with ADB, it works like a charm. But if I try to run the project on AS, the run configuration popup is opened with the error "Please select Android SDK". When I click on Run, the message "Configuration is still incorrect. Do you want to edit it again ?" appears and I can click on "Continue anyway", which gave me the error "Error running app: Please select Android SDK". If I go on the project structure, the compile SDK version is "Google APIs, Android 24 (API 24)", which is what I want.
Here is my build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:24'
buildToolsVersion '25'
defaultConfig {
minSdkVersion 16
targetSdkVersion 22 // SDK 23 /!\ Permissions handling
versionCode 52
versionName "1.6"
applicationId "com.myapp.app"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
signingConfigs {
release {
...
}
}
buildTypes {
debug {
minifyEnabled false
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
}
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
lintOptions {
abortOnError false
}
useLibrary 'org.apache.http.legacy'
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile 'com.android.support:support-v4:24.2.1'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:mediarouter-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:preference-v7:24.2.1'
}
Also, I think it's the same problem, on an xml file, the preview doesn't work. The editor API version is null and none are proposed in the selection. All I can select is "Automatically pick best" which does nothing. I also have a "Unknown attribute warning on each attribute.
I have this problem on a Mac mini with the last version of Yosemite OS. Even after formatting and reinstalling AS and Android SDK, the problem is still here, but I didn't have it few weeks ago. And on a Macbook pro on El Captain, it works fine.
Does someone know about this problem ?