Suppenkasper Suppenkasper - 5 months ago 749
Android Question

Android Studio - Unable to run app on device minSdk(API 23, N) != device Sdk(API 22)

so i reinstalled linux on my computer and after i reinstalled android studio i tried getting an app that i wrote on to my phone which previously had not been a problem. The App ist targeted at devices with API 16 or higher but apparently Android Studio now features something called N preview which does not let me run anything on my phone. specifically when i hit the run button it tells me that


minSdk(API 23, N) != device Sdk(API 22)


i know this seems as though the target API isnt set correctly but when i started the project i set it to 16. Now how do i get around this? Also whats the cleanest way to change the target API on a project? Do i just change the build gradle?

Thanks a lot!

app gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 'android-N'
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.example.josias.myapplication"
minSdkVersion 16
targetSdkVersion 'N'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.+'}


enter image description here

Answer

Change compileSdkVersion 'android-N' to compileSdkVersion 22 and targetSdkVersion 'N' to targetSdkVersion 22