Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 235
Suppenkasper Avatar asked Apr 11 '16 10:04

Suppenkasper


2 Answers

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

like image 78
Yuri Misyac Avatar answered Sep 28 '22 20:09

Yuri Misyac


The same happened to me on Android Studio, so I could not start a new emulator. I had to: Gradle Scripts -> build.gradle (module:app) -> minSdkVersion 14

(update "minSdkVersion" value to "14".

Now I am able to start a new emulator.

like image 44
Maria Clara Bezerra Avatar answered Sep 28 '22 18:09

Maria Clara Bezerra