Reputation: 954
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.+'}
Upvotes: 16
Views: 71962
Reputation:
Changing the minSdkVersion may not always help. Check your SDK Manager, as already suggested, and make sure that you have the necessary versions installed as well (I had changed mine in Gradle, but it only made things worse on my end).
Upvotes: 0
Reputation: 871
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.
Upvotes: 3
Reputation: 1
you can do a thing just open the sdk manager since i had one and just install ,the ÄNDROID N (API 23 N PREVIEW PACKAGES) give it a try instead of changing the gradle files
Upvotes: 0
Reputation: 11
Change the minSdkVersion to your target device sdkVersion in build.gradle(Module:app)file will be appear on left side in Gradle Scripts.. Ex: minSdkVersion 24 //change the version value to ur target device value(like 23 or 22 or 21 or etc)
According to your configuration you have to change the minSdkVersion 23 to minSdkVersion 22, becoz your target device at API LEVEL 1
Upvotes: 0
Reputation: 181
I renctly encountered this problem, and this is very strange, on the other thread there's people suggest you should change you usb setting to "MTP/FTP" or something, this doesnt make sense and dont work out on my case.
After search some example case in this problem, I found that most of people have this problem when minSDK
/'targetSDK'/'compileSdkVersion' is not a int but a letter.
I changed my MNC/N' to 23, and
build - clean build`, problem solved.
hope it can help someone.
Upvotes: 0
Reputation: 1118
This wortk for me in Android Studio: hold ctl+alt+shift press 'S', This will open project structure. Click on the tab 'Flavors', check in min sdk version if appear a version of your device sdk if you see select it and click 'OK', but if you didn't see a option for your sdk device click on cancel. Go to build.gradle(app) file and type in the min sdk version the version of your sdk device(android studio will recomend you to intall the version sdk). After that hold ctl+alt+shift press 'S' and the version sdk min will be there, just select it and click 'ok'. :)
Upvotes: 1
Reputation: 304
See the explain of CommonsWare. The key point is a preview version, so older level device was prevented to install app anyway when using N compileSdkVersion.
Upvotes: 2
Reputation: 4910
Change
compileSdkVersion 'android-N'
to compileSdkVersion 22
and targetSdkVersion 'N'
to targetSdkVersion 22
Upvotes: 15
Reputation: 557
check your build.gradle file to ensure the proper min sdk is set...android studio overrides the manifest with the build.gradle
Upvotes: 0