Installation failed since app's minSdkVersion is newer than device's API level

Viewed 19611

Here is my gradle settings.

ext {
    android_compile_version = 26
    android_version = '26.0.1'
    android_min_sdk_version =15

    appcompat_library_version = '25.2.0'
    support_library_version = '25.2.0'
    gms_library_version = '11.0.4'
}

this is define in my project.gradle file and

apply plugin: 'com.android.application'

android {

    compileSdkVersion android_compile_version
    buildToolsVersion android_version

defaultConfig {

    applicationId "com.xxasda.stickman"

    minSdkVersion android_min_sdk_version
    targetSdkVersion compileSdkVersion
    versionCode 2
    versionName "1.1"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

dependencies {
    compile "com.android.support:appcompat-v7:${appcompat_library_version}"
    compile "com.android.support:support-v4:${support_library_version}"
    compile project(':libraries:BaseGameUtils')
}

buildscript {
    repositories {
        jcenter()
    }
}

This is my Build.Gradle file I don't know why it's not compiling. but when I try to run application on emulator it throws me this error

Failure [INSTALL_FAILED_OLDER_SDK]


Installation failed since app's minSdkVersion is newer than device's API level (API 23).
Please update your apps minSdkVersion.
Error while Installing APK

I checked many times and replace min_sdk_version with absolute value 15 but still no luck.any one please advice it would be helpful.

Thank you. :)

3 Answers

I'm also getting same issue

I have solved my issue making below changes

compileSdkVersion 'android-P'
targetSdkVersion 27

and the dependencies

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support:cardview-v7:28.0.0-alpha1'

hope it help someone

this can also be caused when creating the app and you select a higher minimum sdk so when creating empty activity select the lowest(Icecream) and you wont experience the same...was avictim of the same and i got sorted after realising the it

You can try to add to your build.gradle (D:\AppName\app\build.gradle) the following line under default config:

minSdkVersion 28 //or whatever version you need

    defaultConfig {
    applicationId "com.example.appname"
    minSdkVersion 28 <<<----------------------------------
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Related