Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INSTALL_FAILED_OLDER_SDK with minSdkVersion lower than device API version

On a brand new install of the latest AndroidStudio running the New Project template with min SDK selection of 15 (ICS) trying to run on a Nexus 5 running API 19, I get the INSTALL_FAILED_OLDER_SDK error with the following output. I have made no changes to the project from what the template has generated, so this would be a clean first run that I would expect to work.

Waiting for device.
Target device: lge-nexus_5-{device id}
Uploading file
    local path: /home/{my user name}/AndroidStudioProjects/MyApplication/app/build/outputs/apk/app-debug.apk
    remote path: /data/local/tmp/com.example.{my user name}.myapplication
Installing com.example.{my user name}.myapplication
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.{my user name}.myapplication"
pkg: /data/local/tmp/com.example.{my user name}.myapplication
Failure [INSTALL_FAILED_OLDER_SDK]

This is the default build.gradle file generated for the app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.{my user name}.myapplication"
        minSdkVersion 15
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}
like image 547
Rich Avatar asked Apr 22 '26 06:04

Rich


1 Answers

Check the doc at http://developer.android.com/preview/setup-sdk.html.

You have to use

minSdkVersion 'L'

and you have to run the app in device with Android-L or an emulator with Android-L. The build system when compileSdkVersion is 'android-L' or targetSdkVersion is 'L' forces the minSdk to 'L' to prevent apps published with the API in preview.

like image 119
Gabriele Mariotti Avatar answered Apr 23 '26 21:04

Gabriele Mariotti