Search code examples
androidandroid-emulatorandroid-studio-4.0android-11

The application's minSdkVersion is newer than the device API level (android-R)


I have a device with android version 10.

Also, I have an emulator with API 22

this is a part of my build.gradle(:app) file:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-kapt'

apply plugin: 'kotlin-android-extensions'

android {
    dataBinding {
        enabled = true
    }
    compileSdkVersion 'android-R'
    defaultConfig {
        applicationId "com.example.android.sOnline"
        minSdkVersion 17
        targetSdkVersion 'R'
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
//        android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
    }
}

It just not working on 'android-R'

Thank you for helping me :)


Solution

  • targetSdkVersion "R" will restrict your app to only running on Android R, by artificially raising your minSdkVersion to R. This has been the case for the past several years: each developer preview only supports running the app on the developer preview itself, not older devices.

    Sometime later this year, we will be able to switch to using targetSdkVersion 30, at which point normal behavior returns with respect to minSdkVersion.